On 2011-01-18 16:27, Ben Harrison wrote:
[...snip...]

      plot(Ozone ~ Temp, data = aq)

This highlights one of the very confusing aspects of R language for me;
is plot(x, y) the same as plot (y ~ x)? Seems to be, but maybe I'm
missing some nuance.

plot has many methods; see with methods(plot).
If you go to the help page for plot you'll be pointed
to plot.default and plot.formula (under 'See Also').
Have a look at those to see what the difference is.
The formula method is useful in that it permits you
to set the 'data' argument (which obviates the need
for 'attach'ing.

[...snip...]

    BTW, attach() is not usually a good idea; have a look at ?with.

Great, I thought I had that trick nailed. Obviously there needs to be an
R equivalent of l2tabu.

I wouldn't call it a sin, but I find alternatives like with()
and 'data=' much more convenient.

Peter Ehlers

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to