【发布时间】:2020-10-19 23:11:03
【问题描述】:
试图搜索但没有找到我需要的东西。 我将使用代码来演示我需要什么。
col1=c(4,5,6,4,3,4,5,5,6,9,2,1,0,3,6,7,9);
col2=c(4,2,3,4,3,3,5,6,6,9,2,1,0,3,6,7,1);
col3=c(1,2,3,4,3,4,5,5,6,9,2,1,0,3,6,7,9);
col4=c(4,5,2,4,3,4,2,5,6,5,2,3,0,3,3,7,8);
col5=c("Y","N","N","Y","N","N","Y","N","N","Y","N","N","Y","N","N","Y","N")
d=data.frame(col1,col2,col3,col4,col5)
boxplot(d[,3]~d$col5) # this works, and I got two box bars for col3 and one bar for value "N" in col5 and the other for "Y"
boxplot(d[,1:4]~d$col5) # this does not work. I want 8 bars in the order of col1 N, col1Y, col2 N, col2 Y, ...
如何获得我需要的东西?谢谢!
【问题讨论】:
标签: r split multiple-columns boxplot