diff options
author | yvesf <yvesf-git@xapek.org> | 2010-08-24 21:15:32 +0200 |
---|---|---|
committer | yvesf <yvesf-git@xapek.org> | 2010-08-24 21:15:32 +0200 |
commit | 39e11dd1f20aa30378715466608de8e8014389d9 (patch) | |
tree | fe24a4594c117918f72140a3f2f52437c09b2c60 /test.r | |
parent | de1bbfc28dd9dcc76f8d4a34e1524b1f3a594fdb (diff) | |
download | ebus-alt-39e11dd1f20aa30378715466608de8e8014389d9.tar.gz ebus-alt-39e11dd1f20aa30378715466608de8e8014389d9.zip |
test.r
Diffstat (limited to 'test.r')
-rwxr-xr-x | test.r | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -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) |