I fail to understand the purpose of your post. The error message seems clear enough: either your matrices are not all numeric or you may have data frames among them with non-numeric columns. Have you checked either or both?
?is.matrix ?is.numeric as in lapply(s,is.matrix(x) && is.numeric(x)) (with slight caveats with factors). -- Bert On Wed, Jan 2, 2013 at 2:16 PM, eliza botto <eliza_bo...@hotmail.com> wrote: > > dear useRs, > i have a list containing 16 matrices. i want to calculate the column mean > of each of them. > i tried > >sr <- lapply(s,function(x) colMeans(x, na.rm=TRUE)) > but i am getting the following error > >Error in colMeans(x, na.rm = TRUE) : 'x' must be numeric > can it be done in any other way? and why i am getting this error?? > thanks in advance.. > elisa > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org 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. > -- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org 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.