From bcc3581e4aaef00f82da24e94fdd91c30314290b Mon Sep 17 00:00:00 2001 From: Random Hacker Date: Tue, 31 Aug 2010 16:33:23 +0200 Subject: supsmu entfernt --- test.r | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/test.r b/test.r index 8a5885b..41a4b85 100755 --- a/test.r +++ b/test.r @@ -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) -- cgit v1.2.1