[R] Combining data
gunter.berton at gene.com
Thu Nov 17 22:33:49 CET 2011
" What is the command for combining certain number of data into their
one way would be (calling the data vector, x)"
colMeans(matrix ( x[ seq_len(30 * floor(length(x)/30))], nrow=30))
Note that this will leave out the mean of any values with indices
beyond the largest multiple of 30 less than or equal to the length of
There are probably 87 other ways to do this, many of which might be
better, simpler, faster, or slicker.
On Thu, Nov 17, 2011 at 1:15 PM, MacQueen, Don <macqueen1 at llnl.gov> wrote:
> There is no single command to do all of what you want.
> Read the posting guide for advice on how to ask questions that are more
> likely to receive helpful answers.
> The mean() function is a command for "combining certain number of data
> into their average value".
> The write.csv() function will create a new csv file.
> The aggregate() function may help.
> Don MacQueen
> Lawrence Livermore National Laboratory
> 7000 East Ave., L-627
> Livermore, CA 94550
> On 11/17/11 7:37 AM, "Nasrin Pak" <astronasrin at gmail.com> wrote:
>>It seemed to be easy at first, but I didn't manage to find the answer
>>through the google search. I have a set of data for every second of the
>>experiment, but I don't need such a high resolution for my analysis. I
>>to replace every 30 row of my data with their average value. And then save
>>the new data set in a new csv file to be able to have a smaller excel data
>>sheet. What is the command for combining certain number of data into their
>>MSc Student in Environmental Physics
>>University of Calgary
>> [[alternative HTML version deleted]]
>>R-help at r-project.org mailing list
>>PLEASE do read the posting guide
>>and provide commented, minimal, self-contained, reproducible code.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Genentech Nonclinical Biostatistics
Internal Contact Info:
More information about the R-help