You may also want to consider using Deducer ( http://www.deducer.org ). In addition to the GUI, it contains a series of wrapper functions in which variable names can be written directly. For example:

Correlation Matrix:
cor.matrix(variables=d(mpg,cyl,disp,hp), data=mtcars)

Welch ANOVA:
k.sample.test(formula=d(mpg,disp) ~ cyl,data=mtcars,test=oneway.test)

Contingency table:
contingency.tables(cyl,am,stratum.var=vs,data=mtcars)


Ian

Begin forwarded message:

> From: Ian Fellows <ian.fellows@stat.ucla.edu>
> Date: September 22, 2010 8:12:13 AM PDT
> To: Douglas Bates <bates@stat.wisc.edu>
> Subject: Re: [R-sig-teaching] pros/cons of teaching attach()
> 
> You may also want to consider using Deducer ( http://www.deducer.org ). In addition to the GUI, it contains a series of wrapper functions in which variable names can be written directly. For example:
> 
> Correlation Matrix:
> cor.matrix(variables=d(mpg,cyl,disp,hp), data=mtcars)
> 
> Welch ANOVA:
> k.sample.test(formula=d(mpg,disp) ~ cyl,data=mtcars,test=oneway.test)
> 
> Contingency table:
> contingency.tables(cyl,am,stratum.var=vs,data=mtcars)
> 
> 
> Ian
> 
> 
> On Sep 22, 2010, at 5:10 AM, Douglas Bates wrote:
> 
>> On Wed, Sep 22, 2010 at 4:04 AM, Joshua Wiley <jwiley.psych@gmail.com> wrote:
>>> Thanks to everyone for your thoughtful replies.  I think I am inclined
>>> not to use attach, but to bring it up and briefly mention some of the
>>> mistakes that are easy to make.  If students already know/use attach,
>>> it will at least be clear why I do not use it, and for students
>>> unfamiliar with it, they should not be tempted to start.
>>> 
>>> Thanks again for all the responses!
>> 
>> I avoid teaching attach() and discourage its use if the students have
>> already seen it.  I do teach both with and within (with provides
>> read-only access, within provides read-write access to the variable
>> names in a data frame or a list).  As mentioned in an earlier reply in
>> this thread, the use of extractor functions, like residuals() or
>> fitted() or coef(), should be preferred to reaching inside a data
>> object and grabbing a component that may or may not continue to be
>> defined in future versions,
>> 
>> The supplementary material on R that I use in a first-year grad course
>> on applied statistics is available, for this semester, at
>> www.stat.wisc.edu/~st849-1/Rnotes  My approach to data organization is
>> shown in the "Introduction to R".
>> 
>> _______________________________________________
>> R-sig-teaching@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-teaching
>> 
> 


	[[alternative HTML version deleted]]


