Try
tempFun <- function(x) sum(!is.na(x))
nonZeros <- aggregate(pollution["pol"],format(pollution["date"],"%Y-%j"), FUN
= tempFun)
--- On Wed, 12/8/09, Tim Chatterton wrote:
> From: Tim Chatterton
> Subject: [R] Counting the number of non-NA
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(
2 matches
Mail list logo