[R] plotting

Jim Lemon jim at bitwrit.com.au
Fri Mar 15 03:02:31 CET 2013


On 03/15/2013 02:46 AM, li li wrote:
> Hi alL,
>     I have a data frame with 4 columns: "value", "time",  "group" and "id".
>     I would like to plot "value" vs. "time" with different colors for
> different levels of "group" and
> different symbols for different values of "id".
>     I think I could do this but I would like to see what is an easier way to
> plot
> the data this way.

Hi Hanna,
You will probably want to dress this up a bit:

# rustle up some data
test.df<-data.frame(value=rnorm(80)+4,time=sample(0:23,80,TRUE),
  group=rep(LETTERS[1:4],each=20),id=rep(1:4,each=20))
# plot it
plot(test.df$time,test.df$value,col=test.df$group,pch=test.df$id)

Jim



More information about the R-help mailing list