On Tue, Jun 30, 2009 at 2:36 PM, gug <guygreen@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]]


