1

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?

1 Answer 1

3

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)
Sign up to request clarification or add additional context in comments.

1 Comment

Just curious, did you pick the plot solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.