Reputation: 393
I'm a very beginner to R. So I have 2 data files, A.dat and B.dat like:
1 101203
2 3231233
3 213213
...
So I did
A <- read.table("A.dat", col.names = c("time","power"))
B <- read.table("B.dat", col.names = c("time","power"))
And I want to do line plot for A and B in the same system (Sorry, i can't upload image yet). Any suggestions on how to go about?
Upvotes: 1
Views: 5099
Reputation: 60964
I prefer using ggplot2
(package can be downloaded from CRAN). This first requires a little data processing:
A$group = "A"
B$group = "B"
dat = rbind(A,B)
and then plotting the figure:
ggplot(aes(x = time, y = power, color = group), data = dat) + geom_line()
For base graphics, something like this should work:
plot(power~time, A)
lines(power~time, B)
Upvotes: 3