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

2017-05-09 Thread William Michels via R-help
1 AM, Doran, Harold wrote: > ?round > > > From: lily li [mailto:chocol...@gmail.com] > Sent: Tuesday, May 09, 2017 11:10 AM > To: Charles Determan > Cc: Doran, Harold ; R mailing list > Subject: Re: [R] About calculating average values from several matrices > > Than

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

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

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

2017-05-09 Thread lily li
o:* Charles Determan > *Cc:* Doran, Harold ; R mailing list > > *Subject:* Re: [R] About calculating average values from several matrices > > > > Thanks very much, it works. But how to round the values to have only 1 > decimal digit or 2 decimal digits? I think by divid

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 Cc: Doran, Harold ; R mailing list Subject: Re: [R] About calculating average values from several matrices Thanks very much, it works. But how to round the values to have only 1 decimal

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 >>> > >>> &

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

2017-05-09 Thread lily li
; > >> > >> > ### 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 Charles Determan
on(x) mean(x)) > > > > > > > > ### mean over all columns > > > > sapply(myData, function(x) colMeans(x)) > > > > > > > > > > > > > > > > > > > > > > > > *From:* lily li [mailto:chocol

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

2017-05-09 Thread lily li
to:chocol...@gmail.com] > *Sent:* Tuesday, May 09, 2017 10:44 AM > *To:* Doran, Harold > *Cc:* R mailing list > *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

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

2017-05-09 Thread Doran, Harold
orm(100), 10, 10) } ### mean over all cells sapply(myData, function(x) mean(x)) ### mean over all columns sapply(myData, function(x) colMeans(x)) From: lily li [mailto:chocol...@gmail.com] Sent: Tuesday, May 09, 2017 10:44 AM To: Doran, Harold Cc: R mailing list Subject: Re: [R] About cal

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. Thanks. On Tue, May 9, 2017 at 8:41 AM, Doran, Harold wrote:

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

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