I have a problem, I want to get the daily accumulations of the precipitation variable with the command timeAverage of package openair, so I try this:
CovTemp <- read.table("CovPrec", header = TRUE, sep = ";",
stringsAsFactors = FALSE, dec = ",", na.strings = "NA")
date <- ajuste_tiempos(CovPrec)
Met_CovPrec <- cbind(date, CovPrec[-c(3,4)])
Met_CovPrec$date <- as.POSIXct(strptime(Met_CovPrec$date,
format = "%d/%m/%Y %H:%M", "GMT"))
Met_CovPrec_prom_day <- timeAverage(Met_CovPrec, avg.time = "day", statistic = "sum")
but the result applies to the entire data frame and not just to the data column:
the original data frame CovPrec
MS_NR SS_NR DATE HOUR VALUE 1 13095010 240 1/01/2014 0:00:00 NA 2 13095010 240 1/01/2014 0:10:00 NA 3 13095010 240 1/01/2014 0:20:00 NA 4 13095010 240 1/01/2014 0:30:00 NA 5 13095010 240 1/01/2014 0:40:00 NA 6 13095010 240 1/01/2014 0:50:00 NA
the result Met_CovPrec_prom_day:
date MS_NR SS_NR VALUE 1 2014-01-01 00:00:00 1885681440 34560 0 2 2014-01-02 00:00:00 1885681440 34560 0 3 2014-01-03 00:00:00 1885681440 34560 0 4 2014-01-04 00:00:00 1885681440 34560 28 5 2014-01-05 00:00:00 1885681440 34560 2 6 2014-01-06 00:00:00 1885681440 34560 0
Thank you for your answers