I'm brand new to R, so this might be obvious.
The code I have so far:
rm(list=ls())
kdata = read.table("data_fra_klassen_v20.txt",header = TRUE,)
library(openxlsx)
kdata = read.xlsx("data_fra_klassen_v20.xlsx")
head(kdata)
Here is the dataset:
gender shoe height colour
Man 43 176 Green
Woman 36 166 Brown
Man 43 182 Other
Man 36 151 Brown
Woman 43 183 Blue
Man 44 184 Blue
Woman 38 164 Brown
Woman 37 160 Brown
Man 41 175 Brown
I'm trying to find the mean, and median within each gender.
I was thinking maybe something like this:
heightmen = kdata$height[kdata$gender=="Man"]
mean(heightmen)
However, it seems like it can't find any values.