On Tue, Jun 30, 2009 at 2:36 PM, gug <guygr...@netvigator.com> wrote:

>
> I've been using "attach" because I was following one of the approaches
> recommended in this "Basic Statistics and R" tutorial
> (http://ehsan.karim.googlepages.com/lab251t3.pdf), in order to be able to
> easily use the column headings within the regression formula.
>

It is usually better (and easier) to use the data argument that comes with
many modelling functions. Compare ...

# version 1
lm(y~x, data=my.dataz)

# version 2
attach(my.dataz)
lm(y~x)
detach(my.dataz)

Additionally, using attach you have to make sure there are no objects in
global environment that have the same names as some variables in your data
frame. (Attach will tell you about  "masked objects" if this is the case.)

Kenn

        [[alternative HTML version deleted]]

______________________________________________
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