You can use read.csv to enter data as data.frame. Then you have many options to build. I prefer lattice for most investigations.
Two in the bars. Here I create random data for the chart.
library(lattice) d <- data.frame(index=1:20, x=rnorm(20), y=rnorm(20)) > head(d, n=3) index xy 1 1 -1.065591 0.2422635 2 2 -1.563782 -1.4250984 3 3 1.156537 0.3659411 xyplot(x+y~index, data=d, type='l', auto.key=list(space='right'))
You can generate a formula from the column names. Usually I do not do this from the hint, but I use such constructs in the code:
f <- paste(paste(names(d[,-1,drop=FALSE]), collapse="+"), names(d[,1,drop=FALSE]), sep=" ~ ") xyplot(as.formula(f), data=d, type='l', auto.key=list(space='right'))
As in Ben's answer, type='l' indicates strings. The default value is type='p' for points. I added the auto.key parameter here to mark the series.

Matthew lundberg
source share