[R] plot dataframe with inconsistently relations

R. Michael Weylandt michael.weylandt at gmail.com
Tue Sep 11 18:26:31 CEST 2012


On Tue, Sep 11, 2012 at 2:22 PM, Geophagus <fh at retposto.net> wrote:
> Hi @ all,
> I work with a dataframe like the attached one.

Hi Geo,

Unfortunately, there is no attached data.frame. The mail servers are
somewhat draconian in what they let through. A much better way to send
data is to type

dput(head(DATA, 20))

which will make some odd (to you) output. However, if you copy and
paste that output into the body of your email, we can simply paste it
into our R sessions to exactly reproduce your data. It's really a much
better way to handle sending small data sets. Perhaps try that?

Cheers,
Michael

> I want to plot it, so that  "value" is listed on the y-axis, "year" on the
> x-axis and "states" as lines in the coordinate system.
> I tried the following code:
>
> require(ggplot)
> plot1<-ggplot(TEST, aes(year, value)) + geom_line(aes(colour = state))
>
> The result could be very nice but the the lines are stacked.
> Maybe there is an easier way to do that?
>
> Thanks a lot for your help.
> Geo
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/plot-dataframe-with-inconsistently-relations-tp4642766.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list