I have a data frame in R. A data frame has n columns, and I would like to get n graphs, one graph for each column.
I'm a newbie, and I'm not sure about R, anyway, I found two solutions.
The first one works, but it does not print the column name (and I need them!):
data <- read.csv("sample.csv",header=T,sep=",") for ( c in data ) plot( c, type="l" )
The second one works better because it prints the column name:
data <- read.csv("sample.csv",header=T,sep=",") for ( i in seq(1,length( data ),1) ) plot(data[,i],ylab=names(data[i]),type="l")
Are there any better (in terms of R-point of view) solutions?
Thank. Alessandro
r plot dataframe
Alessandro Jacopson Feb 02 '11 at 16:58 2011-02-02 16:58
source share