Thursday, 15 July 2010

r - Plotting multiple lines from multiple data frames -



r - Plotting multiple lines from multiple data frames -

i'm beginner r. have 2 info files, a.dat , b.dat like:

1 101203 2 3231233 3 213213 ...

so did

a <- read.table("a.dat", col.names = c("time","power")) b <- read.table("b.dat", col.names = c("time","power"))

and want line plot , b in same scheme (sorry, can't upload image yet). suggestions on how go about?

i prefer using ggplot2 (package can downloaded cran). first requires little info processing:

a$group = "a" b$group = "b" dat = rbind(a,b)

and plotting figure:

ggplot(aes(x = time, y = power, color = group), info = dat) + geom_line()

for base of operations graphics, should work:

plot(power~time, a) lines(power~time, b)

r plot ggplot2 data.frame

No comments:

Post a Comment