I have a long dataframe ("pollution") that contains a column of hourly
date information ("date") and a column of pollution measurements ("pol")
I have been happily calculating daily means and daily maximums using the
aggregate function
DMEANpollution = aggregate(pollution["pol"],
format(pollution["date"],"%Y-%j"), mean, na.rm = TRUE)
DMAXpollution = aggregate(pollution["pol"],
format(pollution["date"],"%Y-%j"), max, na.rm = TRUE)
However, I also need to count the number of valid measurements for each
day to check that the mean and max are likely to be valid (for example I
need at least 18 hourly measurements to calculate a valid daily mean)
Try as I might I have not found a simple way of doing this.
Can anybody help please?
Many thanks,
Tim.
--
__________________________________________
Dr Tim Chatterton
Senior Research Fellow
Air Quality Management Resource Centre
Faculty of Environment and Technology
University of the West of England
Frenchay Campus
Bristol
BS16 1QY
Tel: 0117 328 2929
Fax: 0117 328 3360
Email: tim.chatter...@uwe.ac.uk
______________________________________________
R-help@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.