From 064ac0c88a9724c7723bf8f3bceff9168f1a91ce Mon Sep 17 00:00:00 2001 From: Anxo Date: Mon, 30 Apr 2018 18:40:30 +0200 Subject: [PATCH 1/3] data.cap statistic option bug --- R/timeAverage.R | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/R/timeAverage.R b/R/timeAverage.R index a03d2118..1682f48c 100644 --- a/R/timeAverage.R +++ b/R/timeAverage.R @@ -501,27 +501,28 @@ timeAverage <- function(mydata, avg.time = "day", data.thresh = 0, } - if ("wd" %in% names(mydata) && statistic != "data.cap") { - if (is.numeric(mydata$wd)) { + if ("wd" %in% names(mydata){ + if (statistic != "data.cap") { + if (is.numeric(mydata$wd)) { - ## mean wd - avmet <- transform(avmet, - wd = as.vector(atan2(Uu, Vv) * 360 / 2 / pi) - ) + ## mean wd + avmet <- transform(avmet, + wd = as.vector(atan2(Uu, Vv) * 360 / 2 / pi) + ) - ## correct for negative wind directions - ids <- which(avmet$wd < 0) ## ids where wd < 0 - avmet$wd[ids] <- avmet$wd[ids] + 360 + ## correct for negative wind directions + ids <- which(avmet$wd < 0) ## ids where wd < 0 + avmet$wd[ids] <- avmet$wd[ids] + 360 - ## vector average ws - if ("ws" %in% names(mydata)) { - if (vector.ws) { - avmet <- transform(avmet, ws = (Uu ^ 2 + Vv ^ 2) ^ 0.5) + ## vector average ws + if ("ws" %in% names(mydata)) { + if (vector.ws) { + avmet <- transform(avmet, ws = (Uu ^ 2 + Vv ^ 2) ^ 0.5) + } } } - - avmet <- subset(avmet, select = c(-Uu, -Vv)) } + avmet <- subset(avmet, select = c(-Uu, -Vv)) } ## fill missing gaps From 494d3a8468abc7c4fc5fb713004ec3c45df82916 Mon Sep 17 00:00:00 2001 From: Anxo Date: Mon, 30 Apr 2018 18:59:14 +0200 Subject: [PATCH 2/3] Fix unmatched parenthesis --- R/timeAverage.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/timeAverage.R b/R/timeAverage.R index 1682f48c..b53a1b19 100644 --- a/R/timeAverage.R +++ b/R/timeAverage.R @@ -501,7 +501,7 @@ timeAverage <- function(mydata, avg.time = "day", data.thresh = 0, } - if ("wd" %in% names(mydata){ + if ("wd" %in% names(mydata)){ if (statistic != "data.cap") { if (is.numeric(mydata$wd)) { From fadee0bc336f0f0acc5098f8d604b7af358c6585 Mon Sep 17 00:00:00 2001 From: Anxo Date: Tue, 3 Jul 2018 20:53:02 +0200 Subject: [PATCH 3/3] Update aqStats.R Old variable did not exist --- R/aqStats.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/aqStats.R b/R/aqStats.R index e94f2c0c..03d1857b 100644 --- a/R/aqStats.R +++ b/R/aqStats.R @@ -380,9 +380,9 @@ aqStats <- function(mydata, pollutant = "no2", data.thresh = 75, percentile = c( results <- gather(results, key = variable, value = value, -c(site, pollutant, year, date)) - results <- unite(res, site_pol, site, pollutant) + results <- unite(results, site_pol, site, pollutant) - results <- spread(res, site_pol, value) + results <- spread(results, site_pol, value) ## sort out names names(results) <- gsub("\\_", " ", names(results))