我想打印,男性的身高值下具有高度的男性的名字
我发现男的用下面的命令高度的中位数:
y1<-median(ex1[which(ex1$gender=='male')
我试图打印这样的名字:
if (gender=='male')
{
if (height<y1)
print(Names)
}
有人能帮我吗?谢谢 :)
文本文件:
Names height Shoesize gender Location
1 andreas 181 44 male citycenter
4 maria 170 43 female citycenter
5 xristina 172 43 female citycenter
13 nikos 175 42 male outofcity
14 kostas 181 44 male outofcity
15 giannis 180 43 male outofcity
16 eleni 177 43 female outofcity
17 panos 133 41 male outofcity
刚子集或创建新的数据帧
ex1.medheight <- median(ex1$height[ex1$gender=="male"])
ex1.shortmales <- ex1[(ex1$height < ex1.medheight && ex1$gender == "male"),]
在特定的情况下,过滤男性或添加有位disciminator新列的数据帧可能是进一步与数据更好的工作。