From 39e11dd1f20aa30378715466608de8e8014389d9 Mon Sep 17 00:00:00 2001 From: yvesf Date: Tue, 24 Aug 2010 21:15:32 +0200 Subject: test.r --- test.r | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 test.r 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) -- cgit v1.2.1