[R] Strange behaviour in plot and points?

Liaw, Andy andy_liaw at merck.com
Tue Jul 2 14:11:46 CEST 2002


Your call to plot is equivalent to plot(data$dummy1, NULL), or
plot(data$dummy1), which plots data$dummy1 against the index.  That is the
expected behavior.  Look at the default arguments to plot.default.

Cheers,
Andy

> -----Original Message-----
> From: miguel bernal [mailto:miguel.bernal at ma.ieo.es]
> Sent: Tuesday, July 02, 2002 5:15 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] Strange behaviour in plot and points?
> 
> 
> Hello R-users
> 
> I was puzzled by some strange results of an analysis and I 
> found out what is 
> for me a strange behaviour (I won't dare to say a bug) in 
> both plot and 
> points (and I suspect lines and other kind of lower level 
> plots). If you try 
> the following code:
> 
> > data<-data.frame(dummy1=c(1:10),dummy2=c(1:10))
> > plot(data$dummy1,data$dummy3)
> 
> A plot of the values of dummy1 against an index is produced, 
> even when dummy3 
> does not exist. Same happens with points. Also, the index is 
> used as the 
> x-axis, so specially when using points in a plot already 
> made, the results 
> can be missleading. 
> 
> Wouldn't it be better to just have an error message saying 
> dummy3 does not 
> exist? 
> 
> I assume this behaviour is not release, nor plattform 
> dependent, but just in 
> case, I am using R 1.5.0 on Mandrake 8.2 Linux.
> 
> Thanks for your comments
> 
> -- 
> Miguel Bernal
> 
> Instituto Español de Oceanografía
> Centro Oceanográfico de Malaga
> Puerto pesquero s/n 29640, Fuengirola.
> Malaga, Spain
> Tlf: (34) 952 471907; Fax: (34) 952 463808
> e-mail: miguel.bernal at ma.ieo.es
> http:\\www.ieo.es
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
> -.-.-.-.-.-.-.-.-
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
> _._._._._._._._._
> 


------------------------------------------------------------------------------
Notice:  This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message.  If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it.

==============================================================================

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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