Skip to content
Back to formatted view

Raw Message

Message-ID: <51428137.4000306@bitwrit.com.au>
Date: 2013-03-15T02:02:31Z
From: Jim Lemon
Subject: plotting
In-Reply-To: <CAHLnndYTmXF2w0tvVKAUv9FjrCosSbS-R=e00x2RZD+iu+EwGQ@mail.gmail.com>

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