Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

r calculate means of numeric variable for predetermined time step

$
0
0

I have a data set of observations that have taken place at specific date/time point; these are usually about a minute apart but can be more or less. And there are some extended periods for missing observations (power outage in the recording equipment). I'd like to generate a new data set with one date/time variable and one value variable. The date/time variable starts on a time that is a multiple of x and steps every x minutes, where x is a multiple of 5 or 10. The value variable holds the mean of the observations in that window. When there is n x minute window with no data, the value variable is set to NA. The question and answer at this link gets me part way there but I can't tell how to deal with the windows with no data.

I'll post this initially with no example data but if no-one can point me to an answer based just on the general question, I'll figure out how to add the data


Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>