timeAverage(mydata,
period = "day",
data.thresh = 0,
statistic = "mean",
percentile = 95,
start.date = NA)date field . Can be class
POSIXct or Date.statistic =
"percentile". The default is 95.POSIXct and will
remove any non-numeric columns except a column "site".timeAverage will remove any character or
factor columns - except if a column "site" is available. This is
necessary because characters/factors cannot be sensibly averaged. If
merging with a daily time series with dates in Date format, it
will be necessary to convert the format of the output e.g. mydata$date
<- as.Date(mydata$date) before merging.timeAverage should be useful in many circumstances where it is
necessary to work with different timeAverage data. For example, hourly
air pollution data and 15-minute meteorological data. To merge the two
data sets timeAverage can be used to make the meteorological
data 1-hour means first.
For the research community timeAverage should be useful for
dealing with outputs from instruments where there are a range of time
periods used.
It is also very useful for plotting data using
timePlot. Often the data are too dense to see patterns
and setting different averaging periods easily helps with interpretation.timePlot that plots time series data and
uses timeAverage to aggregate data where necessary.## daily average values
daily <- timeAverage(mydata, period = "day")
## daily average values ensuring at least 75 \% data capture
## i.e. at least 18 valid hours
daily <- timeAverage(mydata, period = "day", data.thresh = 75)
## 2-weekly averages
fortnight <- timeAverage(mydata, period = "2 week")Run the code above in your browser using DataLab