Hello, John: How about this? > df.name <- aov.out$call$data > var.names <- names(aov.out$model)
I think it works to achieve your goals, but it may be that there are more elegant ways. # By the way, I guess you're an experimental/cognitive psychologist # from variable names in your example. It's my joy, because there are # few R-users in my circle. -- MIYAMOTO Yusuke Graduate School of Human Sciences, Osaka University <[EMAIL PROTECTED]> http://koko15.hus.osaka-u.ac.jp/~yusuke/ On Sat, 22 Mar 2003 15:27:17 -0800 (PST) John Miyamoto <[EMAIL PROTECTED]> wrote: > Dear R Users, > I want to write a function that applies to the dataframe and variables > that were used in a previous call to lm or aov. In order to do this, I > need to write a function that applies to the output of lm or aov, and > yields the names of the dataframe and variables that were used in the lm > or aov analysis. > For example, suppose that I give the command: > > aov.out <- aov( Rt ~ Vis*Cmplx*Isi, data = Rt.data) > > I want to write a function E that applies to aov.out such that > > E(aov.out) = c("Rd.data", "Rt", "Vis", "Cmplx", "Isi"). > > In other words, I want to write an extractor function that yields the > dataframe and variables that were used in a previous call to lm or aov. I > realize that aov.out$call shows this information, but I don't know how to > automatically extract the names of the dataframe and variables from > aov.out$call. The reason I am trying to extract these names is that I > want to write a general purpose function that displays descriptive > statistics and plots that are relevant to an aov or lm analysis. If I > could extract these names from previous aov or lm output, I wouldn't have > to mention them individually as inputs to my function. > > John Miyamoto > > -------------------------------------------------------------------- > John Miyamoto, Dept. of Psychology, Box 351525 > University of Washington, Seattle, WA 98195-1525 > Phone 206-543-0805, Fax 206-685-3157, Email [EMAIL PROTECTED] > Homepage http://faculty.washington.edu/jmiyamot/ > -------------------------------------------------------------------- > > ______________________________________________ > [EMAIL PROTECTED] mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
