summaryrefslogtreecommitdiff
path: root/test.r
diff options
context:
space:
mode:
authorRandom Hacker <random_hacker@xapek.org>2010-08-27 19:46:02 +0200
committerRandom Hacker <random_hacker@xapek.org>2010-08-27 19:46:02 +0200
commit05859a90d82238880101d9414f7e43f2201cd290 (patch)
tree4a9977eda3b8c068555cbe0cfde8644b9a8cc950 /test.r
parentdef9c7873cd3a42fbb7b0b4b21ae364e4c9d61c8 (diff)
parent39e11dd1f20aa30378715466608de8e8014389d9 (diff)
downloadebus-alt-05859a90d82238880101d9414f7e43f2201cd290.tar.gz
ebus-alt-05859a90d82238880101d9414f7e43f2201cd290.zip
Merge branch 'master' of /var/repos/ebus
Diffstat (limited to 'test.r')
-rwxr-xr-xtest.r25
1 files changed, 25 insertions, 0 deletions
diff --git a/test.r b/test.r
new file mode 100755
index 0000000..166342f
--- /dev/null
+++ b/test.r
@@ -0,0 +1,25 @@
+#!/usr/bin/Rscript --vanilla
+require(RPostgreSQL)
+
+drv <- dbDriver("PostgreSQL")
+con <- dbConnect(drv, host="10.2.2.22", user="jack", password="jack", dbname="ebus")
+
+
+# plot 1
+png(file = "Rplots.png")
+data <- dbGetQuery(con, "select DISTINCT timestamp,value_float from value where sensor_id = 47")
+print(data)
+data$timestamp <- as.POSIXlt(as.character(data$timestamp))
+
+plot(data$timestamp, data$value_float,type="l",axes=FALSE)
+
+r <- as.POSIXct(range(data$timestamp))
+axis.POSIXct(1, at=seq(r[1], r[2], by="hour"), format="%H")
+
+title("Temperaturplot")
+box()
+print(data)
+
+dev.off()
+
+#dbDisconnect(con)