[R] Plotting multiple columns on same graph
Andrew Perrin
andrew_perrin at unc.edu
Mon Feb 11 14:31:19 CET 2002
Thanks to all who replied - this is essentially what I ended up doing.
Andy Perrin
----------------------------------------------------------------------
Andrew J Perrin - andrew_perrin at unc.edu - http://www.unc.edu/~aperrin
Assistant Professor of Sociology, U of North Carolina, Chapel Hill
269 Hamilton Hall, CB#3210, Chapel Hill, NC 27599-3210 USA
On Fri, 8 Feb 2002, Scot W McNary wrote:
>
>
> Andrew,
>
> What about preprocessing the dataset to remove NAs?
>
>
> eomit<-na.omit(efficacy.df)
> attach(eomit)
> rs<-cbind(complicated, havesay, dontcare)
> matplot(year, rs)
> matlines(year, rs)
>
>
>
>
> Scot
>
>
> --
> Scot W. McNary email:smcnary at charm.net
>
> On Fri, 8 Feb 2002, Andrew Perrin wrote:
>
> > I'd like to produce a series of simple line graphs for my methods class
> > that show the three questions used on a repeated survey to make up a
> > particular index. The data frame is:
> >
> > > efficacy.df
> > year complicated havesay dontcare
> > 1 1952 71 68 63
> > 2 1954 NA NA NA
> > 3 1956 64 71 71
> > 4 1958 NA NA NA
> > 5 1960 59 72 73
> > 6 1962 NA NA NA
> > 7 1964 67 70 62
> > 8 1966 69 60 57
> > 9 1968 71 58 55
> > 10 1970 73 64 50
> > 11 1972 74 59 49
> > 12 1974 72 57 46
> > 13 1976 70 56 44
> > 14 1978 NA 53 45
> > 15 1980 71 59 43
> > 16 1982 NA 52 50
> > 17 1984 70 68 57
> > 18 1986 66 NA 43
> > 19 1988 66 50 37
> > 20 1990 65 34 23
> > 21 1992 63 57 37
> > 22 1994 73 34 22
> > 23 1996 60 38 24
> > 24 1998 71 46 25
> > 25 2000 NA 50 33
> >
> >
> > The ideal graph will show each of the three questions as a different
> > color line, with lines connecting years spanned by NA values. What's the
> > easiest way to do this?
> >
> > Thanks.
> >
> > ----------------------------------------------------------------------
> > Andrew J Perrin - andrew_perrin at unc.edu - http://www.unc.edu/~aperrin
> > Assistant Professor of Sociology, U of North Carolina, Chapel Hill
> > 269 Hamilton Hall, CB#3210, Chapel Hill, NC 27599-3210 USA
> >
> >
> > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> > r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> > Send "info", "help", or "[un]subscribe"
> > (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
> > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> >
>
>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list