I would like to plot each column of a data.frame using a histogram on one page. Here is an example using the sample "diamonds" data set which comes with R:
p = list()
for (i in 1:ncol(diamonds)) p[[i]] <- qplot(diamonds[,i], xlab=names(diamonds)[[i]])
do.call(grid.arrange, p)
This does plot all the columns, but the data looks the same in each one. So, something is clearly wrong.
Is this the right approach for this task? I'm sure I have some silly syntax somewhere that is assigning the same column data set to each element in the list, but I'm not sure what it is.
Thank you
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…