我有以下數據如何將多列切片成boxplot?
我試圖用下面的命令繪製一列,它的工作原理。但是,試圖畫出幾列時,該命令不起作用
#this works but only for one column boxplot(as.numeric(new[[2]]), horizontal = T, col = "lightblue", notch = T, main="Heart Failure Mortality")
#does not work, I am trying to get the first 3 columns boxplot(as.numeric(new[[c(1:3)]]))
截圖不是如此有用。請使用'dput(head(new,10))'並轉儲給我們一個[Minimum Complete Reproducible Example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-例)。當你說*「不起作用」*時,告訴我們你得到的錯誤。 – smci
'new [[2]]'提取一個數據幀列作爲一個向量,但是你不能將其推廣到'new [[c(1:3)]]',你想'new [,c(1:3 )]'。請閱讀'[..]'運營商的['?'[''page](https://stat.ethz.ch/R-manual/R-devel/library/base/html/Extract.html) 。 – smci
另外,如果由於'read.csv()'這些列是非數字的,請參閱'read.csv(...,colClasses)'的用法,以便它們在第一次正確讀取時,甚至不會必須做轉換。 – smci