summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtest.r23
1 files 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)