Re: [R] Counting the number of non-NA values per day

2009-08-11 Thread Moshe Olshansky
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

[R] Counting the number of non-NA values per day

2009-08-11 Thread Tim Chatterton
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(