summaryrefslogtreecommitdiff
path: root/test.r
diff options
context:
space:
mode:
authoryvesf <yvesf-git@xapek.org>2010-08-24 21:15:32 +0200
committeryvesf <yvesf-git@xapek.org>2010-08-24 21:15:32 +0200
commit39e11dd1f20aa30378715466608de8e8014389d9 (patch)
treefe24a4594c117918f72140a3f2f52437c09b2c60 /test.r
parentde1bbfc28dd9dcc76f8d4a34e1524b1f3a594fdb (diff)
downloadebus-alt-39e11dd1f20aa30378715466608de8e8014389d9.tar.gz
ebus-alt-39e11dd1f20aa30378715466608de8e8014389d9.zip
test.r
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)