Are you trying to take the mean over all cells, or over rows/columns within each dataframe. Also, are these different dataframes stored within a list or are they standalone?
-----Original Message----- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of lily li Sent: Tuesday, May 09, 2017 10:39 AM To: R mailing list <r-help@r-project.org> Subject: [R] About calculating average values from several matrices Hi R users, I have a question about manipulating the data. For example, there are several such data frames or matrices, and I want to calculate the average value from all the data frames or matrices. How to do it? Also, should I convert them to data frame or matrix first? Right now, when I use typeof() function, each one is a list. file1 jan feb mar apr may jun jul aug sep oct nov app1 1.1 1.2 0.8 0.9 1.3 1.5 2.2 3.2 3.0 1.2 1.1 app2 3.1 3.2 2.8 2.5 2.3 2.5 3.2 3.0 2.9 1.8 1.8 app3 5.1 5.2 3.8 4.9 5.3 5.5 5.2 4.2 5.0 4.2 4.1 file2 jan feb mar apr may jun jul aug sep oct nov app1 1.9 1.5 0.5 0.9 1.2 1.8 2.5 3.7 3.2 1.5 1.6 app2 3.5 3.7 2.3 2.2 2.5 2.0 3.6 3.2 2.8 1.2 1.4 app3 5.5 5.0 3.5 4.4 5.4 5.6 5.3 4.4 5.2 4.3 4.2 file3 has the similar structure and values... There are eight such files, and when I use the function mean(file1, file2, file3, ..., file8), it returns the error below. Thanks for your help. Warning message: In mean.default(file1, file2, file3, file4, file5, file6, file7, : argument is not numeric or logical: returning NA [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.