[R] plot dataframe with inconsistently relations
R. Michael Weylandt
michael.weylandt at gmail.com
Wed Sep 12 17:27:40 CEST 2012
On Wed, Sep 12, 2012 at 9:02 AM, Geophagus <fh at retposto.net> wrote:
> Hi @ all and thanks a lot for your advises.
> So far I don't know the function dput. Now I read something about it and I
> have the following result:
>
>> TEST
> year value state
> 1 2007 15 FL
> 2 2008 16 FL
> 3 2008 14 TX
> 4 2008 13 TN
> 5 2009 18 FL
> 6 2009 15 OH
> 7 2010 19 TX
> 8 2010 12 OH
>> dput(TEST)
> structure(list(year = c(2007L, 2008L, 2008L, 2008L, 2009L, 2009L,
> 2010L, 2010L), value = c(15L, 16L, 14L, 13L, 18L, 15L, 19L, 12L
> ), state = structure(c(1L, 1L, 4L, 3L, 1L, 2L, 4L, 2L), .Label = c("FL",
> "OH", "TN", "TX"), class = "factor")), .Names = c("year", "value",
> "state"), class = "data.frame", row.names = c(NA, -8L))
ggplot(TEST, aes(year, value)) + geom_line(aes(colour = state))
Thank you: I'm afraid I don't see what the problem is? (Your unquoted
context has "lines are stacked" IIRC) This seems entirely legible to
me, but the TN line is missing because it's only a single data point.
Cheers,
Michael
More information about the R-help
mailing list