Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
带有特定数据的R程序箱线图_R_Boxplot - Fatal编程技术网

带有特定数据的R程序箱线图

带有特定数据的R程序箱线图,r,boxplot,R,Boxplot,作为R的新手,我脑子里有一些问题。你们能帮我吗 我有一系列的数据 X Gender Score Postal 1 F 427.395 123455 2 F 922.080 642362 3 M 114.500 123947 4 M 176.345 236835 5 F 523.140

作为R的新手,我脑子里有一些问题。你们能帮我吗

我有一系列的数据

X     Gender     Score         Postal
1       F       427.395        123455
2       F       922.080        642362
3       M       114.500        123947 
4       M       176.345        236835
5       F       523.140        849729
以上是500个数据样本

我想分别对女性和男性的分数做一个箱线图。然而,还有邮政编码,也将在箱线图中捕获。我如何为箱线图创造条件,以便仅从X和分数中捕获数据,并按性别分类

在绘制箱线图之前,我尝试先进行排序,但似乎无法使其工作。你们有什么想法吗

提前谢谢

调用数据df,使用:

使用ggplot:

library(ggplot2)
ggplot(df) + geom_boxplot(aes(x=Gender, y=Score, color=Gender))
来吧,第一个谷歌R boxplot的结果告诉你答案!
library(ggplot2)
ggplot(df) + geom_boxplot(aes(x=Gender, y=Score, color=Gender))