身高低于男性中位数的男性名字
Names of males with height under male's median
我正在尝试打印身高低于男性身高中位数的男性姓名
我使用以下命令找到男性身高的中位数:
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"),]
在特定情况下,针对男性过滤数据框或添加带有中值鉴别器的新列可能更适合进一步处理数据。
我正在尝试打印身高低于男性身高中位数的男性姓名
我使用以下命令找到男性身高的中位数:
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"),]
在特定情况下,针对男性过滤数据框或添加带有中值鉴别器的新列可能更适合进一步处理数据。