diff options
Diffstat (limited to 'test.r')
-rwxr-xr-x | test.r | 23 |
1 files changed, 11 insertions, 12 deletions
@@ -41,20 +41,19 @@ readNumericSensorDay <- function (sensorName) { " AND timestamp > now() - interval '1 day'", " ORDER BY timestamp desc", sep="")) d$timestamp <- as.POSIXct(round(d$timestamp, "mins")) - d <- supsmu(as.vector(d$timestamp), as.vector(d$value)) + #d <- supsmu(as.vector(d$timestamp), as.vector(d$value)) names(d) <- c("time", "value") -# myMean <- function(values) { -# print(mad(values)) -# if (mad(values) > 1) { -# print(paste("Streiche ",length(values), -# " Werte aus",sensorName, -# "mad =", mad(values))) -# values <- values * NA -# } -# mean(values) -# } -# + myMean <- function(values) { + if (mad(values) > 2) { + print(paste("Streiche ",length(values), + " Werte aus",sensorName, + "mad =", mad(values))) + values <- values * NA + } + mean(values) + } + # dm <- aggregate(d$value, list(time=d$time), myMean) dm <- d dm$time <- as.POSIXct(dm$time,origin=nulltime) |