Re: [R] Averaging uneven measurements by time with uneven numbers of measurements

From: <Adele_Thompson_at_cargill.com>
Date: Fri, 06 May 2011 12:34:42 -0500

Here is an example of what I would like to do: meas = measurements
times = time of measurement
measf = measurements in final, reduced matrix timesf = time of measurement in final matrix

meas<-runif(30)
times<-sort(runif(30))
inputmat<-cbind(times,meas)
names(inputmat)<-c("timef","measf")

I would then like to break the times up into 0.2 increments so the final matrix would look like this: timef measf
0.2 <mean of meas where (time >=0) and (time<0.2)> 0.4

.
.
.

1.0

Instead of measf being the mean, it could be the last measurement taken.

-----Original Message-----
From: ehlers_at_ucalgary.ca [mailto:ehlers_at_ucalgary.ca] Sent: Thursday, May 05, 2011 03:58 PM
To: Thompson, Adele - Adele_Thompson_at_cargill.com Cc: r-help_at_r-project.org
Subject: Re: [R] Averaging uneven measurements by time with uneven numbers of measurements

On 2011-05-05 14:20, Schatzi wrote:
> I do not want smoothing as the data should have jumps (it is weight left in
> feeding bunker). I was thinking of maybe using a histogram-like function and
> then averaging that. Not sure if this is possible.

(It would be useful to include your original request - not everyone uses Nabble.)

Actually, averaging *is* smoothing, but I suppose your intent is, for some reason, not to smooth across 30-minute boundaries.

Perhaps you could use findInterval() to identify which measurements to average.

Peter Ehlers

>
> -----
> In theory, practice and theory are the same. In practice, they are not - Albert Einstein
> --
> View this message in context: http://r.789695.n4.nabble.com/Averaging-uneven-measurements-by-time-with-uneven-numbers-of-measurements-tp3499337p3499386.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help_at_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.



R-help_at_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. Received on Fri 06 May 2011 - 17:37:28 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 06 May 2011 - 18:10:05 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive