Re: [R] About calculating average values from several matrices

2017-05-09 Thread William Michels via R-help
Doran, Harold <hdo...@air.org> wrote: > ?round > > > From: lily li [mailto:chocol...@gmail.com] > Sent: Tuesday, May 09, 2017 11:10 AM > To: Charles Determan <cdeterma...@gmail.com> > Cc: Doran, Harold <hdo...@air.org>; R mailing list <r-help@r-project.

Re: [R] About calculating average values from several matrices

2017-05-09 Thread lily li
as expected > > > > *From:* lily li [mailto:chocol...@gmail.com] > *Sent:* Tuesday, May 09, 2017 11:13 AM > *To:* Doran, Harold <hdo...@air.org> > *Cc:* Charles Determan <cdeterma...@gmail.com>; R mailing list < > r-help@r-project.org> > > *Subject:* Re

Re: [R] About calculating average values from several matrices

2017-05-09 Thread Doran, Harold
l.com>; R mailing list <r-help@r-project.org> Subject: Re: [R] About calculating average values from several matrices Yes, that means to control decimal numbers. For example, use round(2.3122, digits=1), it gets 2.3 On Tue, May 9, 2017 at 9:11 AM, Doran, Harold <hdo...@air.org<mailt

Re: [R] About calculating average values from several matrices

2017-05-09 Thread lily li
2017 11:10 AM > *To:* Charles Determan <cdeterma...@gmail.com> > *Cc:* Doran, Harold <hdo...@air.org>; R mailing list <r-help@r-project.org > > > *Subject:* Re: [R] About calculating average values from several matrices > > > > Thanks very much, it works. But ho

Re: [R] About calculating average values from several matrices

2017-05-09 Thread Doran, Harold
?round From: lily li [mailto:chocol...@gmail.com] Sent: Tuesday, May 09, 2017 11:10 AM To: Charles Determan <cdeterma...@gmail.com> Cc: Doran, Harold <hdo...@air.org>; R mailing list <r-help@r-project.org> Subject: Re: [R] About calculating average values from several matrices

Re: [R] About calculating average values from several matrices

2017-05-09 Thread Charles Determan
<- matrix(rnorm(100), 10, 10) >>> > >>> > } >>> > >>> > >>> > >>> > ### mean over all cells >>> > >>> > sapply(myData, function(x) mean(x)) >>> > >>> > >&g

Re: [R] About calculating average values from several matrices

2017-05-09 Thread lily li
>> > I'm trying to get a new dataframe or whatever to call, which has the >> same >> > structure with each file as listed above. For each cell in the new >> > dataframe or the new file, it is the average value from former >> dataframes >> > at the same location. Th

Re: [R] About calculating average values from several matrices

2017-05-09 Thread Charles Determan
t; > ### mean over all cells > > > > sapply(myData, function(x) mean(x)) > > > > > > > > ### mean over all columns > > > > sapply(myData, function(x) colMeans(x)) > > > > > > > > > > > > > > > > > > > > > > &

Re: [R] About calculating average values from several matrices

2017-05-09 Thread lily li
lily li [mailto:chocol...@gmail.com] > *Sent:* Tuesday, May 09, 2017 10:44 AM > *To:* Doran, Harold <hdo...@air.org> > *Cc:* R mailing list <r-help@r-project.org> > *Subject:* Re: [R] About calculating average values from several matrices > > > > I'm trying to

Re: [R] About calculating average values from several matrices

2017-05-09 Thread Doran, Harold
<r-help@r-project.org> Subject: Re: [R] About calculating average values from several matrices I'm trying to get a new dataframe or whatever to call, which has the same structure with each file as listed above. For each cell in the new dataframe or the new file, it is the average value from f

Re: [R] About calculating average values from several matrices

2017-05-09 Thread lily li
un...@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 ex

Re: [R] About calculating average values from several matrices

2017-05-09 Thread Doran, Harold
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 fr

[R] About calculating average values from several matrices

2017-05-09 Thread lily li
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