Note that you don't really need list or llist in this case: summarize(x, by = mydata[2:3], FUN = mean, na.rm = TRUE)
Also you could use aggregate: aggregate(mydata[1], mydata[2:3], mean, na.rm = TRUE) On 12/28/06, Muenchen, Robert A (Bob) <[EMAIL PROTECTED]> wrote: > Hi All, > > > > I'm using the Hmisc summarize function and used list instead of llist to > provide the by variables. It generated an error message. Is this a bug, > or do I misunderstand how Hmisc works with lists? The program below > demonstrates the error message. > > > > Thanks, > > Bob > > > > x<-1:8 > > group <- c(1,1,1,1,2,2,2,2) > > gender<- c(1,2,1,2,1,2,1,2) > > > > mydata<-data.frame(x,group,gender) > > attach(mydata) > > > > # Creating a list using Hmisc llist works: > > summarize(x, by=llist(group,gender), FUN=mean, na.rm=TRUE) > > > > # Creating a list using built-in list function does not: > > summarize(x, by= list(group,gender), FUN=mean, na.rm=TRUE) > > > > ========================================================= > Bob Muenchen (pronounced Min'-chen), Manager > Statistical Consulting Center > U of TN Office of Information Technology > 200 Stokely Management Center, Knoxville, TN 37996-0520 > Voice: (865) 974-5230 > FAX: (865) 974-4810 > Email: [EMAIL PROTECTED] > Web: http://oit.utk.edu/scc <http://oit.utk.edu/scc> , > News: http://listserv.utk.edu/archives/statnews.html > <http://listserv.utk.edu/archives/statnews.html> > ========================================================= > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > [email protected] 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. > ______________________________________________ [email protected] 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.
