Re: [R] Plot()

From: Uwe Ligges <ligges_at_statistik.uni-dortmund.de>
Date: Thu 12 May 2005 - 21:11:59 EST

Ute Visser wrote:

> Hello!
>
> I wonder why the x and the y expression are treated differently in the
> plot-function?
> In the example below I should get three times the same graph, shouldn't
> I?
>
> column<-c(0,1)
> par(mfrow = c(3,1))
> plot((1-column)~column)
> plot(column~(1-column))

In right hand sides of formulas you have to use I() in order to do these calculations:

  plot(column ~ I(1-column))

or plot() will simply plot against the index (column ~ 1) and ignores the unsensible last part "-column".

Uwe Ligges

> plot(column~as.vector(1-column))
>
> Thanks for checking!
>
> U
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu May 12 21:15:44 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:44 EST