diff options
-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) |