This thread is interesting. For those who use the
subset command, when you extract a variable from a
data frame, do you give it the same name as in the data set?

For instance,

my.data with variables trout, whale

trout <- subset(my.data, select=trout, drop=T)

I guess if you never attach, then you don't have to
worry about masking in the future.

Thanks

-Laura
On 9/21/2010 11:34 PM, Joshua Wiley wrote:
Hi all,

I am wondering if anyone teaches the attach function to new students
and if so, why?


I have never taught a class using R, but in small tutorials and
providing direct help, I have run across this issue several times.  I
have always avoided it, but a couple of times, students had learned to
use it in a class (though without much detail) and were rather grumpy
with me for using full variable names or with().  New converts,
particularly from GUIs like SPSS, already tend to be leery of R, and I
hate to make working at the command line more onerous since any typing
is more than they are used to, but at the same time a discussion of
environments, which I think is necessary to avoid trouble with attach,
does not seem like beginner material either.

I have wondered about this many times, but was just reminded again by
an R-help post.

Thanks,

Josh


--
************************************************
Laura Chihara
Professor of Mathematics  507-222-4065 (office)
Dept of Mathematics       507-222-4312 (fax)
Carleton College
1 North College Street
Northfield MN 55057

_______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-teaching

Reply via email to