[R] using by to plot
Peter Malewski
peter.malewski at gmx.de
Tue Aug 28 18:00:53 CEST 2001
I do not think that you are looking for this:
xx <- data.frame(x=rnorm(100),y=rnorm(100),p=1:4)
by(xx,xx$p,function(x){par(new=T);plot(x$x,x$y,pch=x$p)})
this dosn't make sence. Perhaps you are looking for:
plot(xx$x,xx$y,pch=xx$p)
p.
On Tue, Aug 28, 2001 at 11:14:37AM -0400, David White wrote:
>
>
> Hello,
>
> I would like to use by to create a series of plots, but I'm not sure how
> to design the function.
>
> Here's what I've got:
>
> 1. A data frame of observations of measured value 2 measured vlaues and a
> pch code.
>
> V1 V2 pchCode
> .0045 123 1
> .0034 145 2
> .0045 123 1
> .0046 167 3
> ...
>
> So what I want to do is create a single scatterplot of the multiple
> conditions (specified by pchCode) and use pchCode to specify the plotting
> character within the plotting function.
>
> I'm imagining something like
>
> by(df, pchCode, function(x) plot(V1, V2, pch=pchCode))
>
> What I don't know how to code is:
> 1. getting the pch to be defined by the pchCode
> 2. specifying that par(new=TRUE) within the by command.
>
> Thanks for you suggestions,
>
> Best,
>
> David
>
>
> S. David White
> sdavidwhite at bigfoot.com
> Columbus, Ohio
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
--
P.Malewski, Limmerstr.47, 30451 Hannover, 0511-2135008
At work: http://www.MH-Hannover.de 0511 532 3194 / Fax: 0511 532 3190,
P.Malewski at tu-bs.de, peter.malewski at gmx.de, malewski.peter at mh-hannover.de.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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