[R] Creating a simple line graph
petr.pikal at precheza.cz
Tue Aug 25 11:29:49 CEST 2009
Do not use cbind as it results in matrix and it can have only data of one
type, in your case character. Use
instead. And you probably could go step further to put everything into one
DF <- data.frame(Sz,Pred, Obs)
with(DF, plot(Pred, Obs, axes=F))
axis(1, at=DF$Pred, DF$Sz)
r-help-bounces at r-project.org napsal dne 25.08.2009 10:51:16:
> I couldn't quite understand exactly what graph you are looking for, so
> I'd be unable to provide code. Couple of pointers, though.
> - Put your data into a data frame and look at Rcmdr "Graphs" menu. It
> can do many types of them, and it should give you enough examples to
> get started with.
> - Try plot(x, y) and see if it satisfies your needs
> - Once you get working the command, try say playwith(plot(x, y))
> - Quick-R  contains many good examples for beginners.
>  http://www.statmethods.net/graphs/index.html
> On 8/24/09, PDXRugger <J_R_36 at hotmail.com> wrote:
> > Hey everyone,
> > Sorry for yet another simple question but hopefully it makes
> > comes up with the answer feel good about helping others. I would
> > simply plot the following two sets of data in a line graph. The one
> > an observed set of points and the latter is the predicted. I have
> > through the documentation (which makes any graphing very complicated
> > but i havent found what i need. So for:
> > Sz= c("h1","h2","h3","h4")
> > Pred=c(34790.0 ,47559.8, 21197.8, 28198.6)
> > Obs=c(34740 ,48615 ,20420, 26840)
> > MeanEst2000.Sz=cbind(Sz,Pred)
> > LaneCo2000HH.Sz =cbind(Sz,Obs)
> > I would like the x-axis to display the labels(Sz) and the y-axis to
> > vlaues
> > I am currently using the below (wont work with sample data) which
> > the proportions of the observed versus the predicted in four
> > graphs in histogram format.
> > panelHist(DataMatrix=t(apply(Hh2000.SnSz, 1, 4)),
> > ObsMeans=proportion(rowSums(LaneCo2000HH.SzWk),4),
> > Bounds=c(0.95, 1.05)
> > )
> > Also, if there is additional documentation for these operations i
> > appreciate any insights./ Thanks
> > --
> > View this message in context:
> > 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
> > and provide commented, minimal, self-contained, reproducible code.
> Do you know how to read?
> Do you know how to write?
> R-help at r-project.org mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help