mainscntanalysis/secondDbSteps.r

11 lines
416 B
R
Raw Normal View History

2021-08-09 13:38:11 +02:00
library(DBI)
library(tidyr)
con <- dbConnect(RPostgres::Postgres(), dbname='mainscnt', host='172.16.10.27', user='wn')
res <-dbSendQuery(con, "select time, location, freq from mainsfrequency where valid=1 and time >= '2021-08-05T00:00:00.0Z' and time < '2021-08-06T00:00:00.0Z'")
devices <- dbFetch(res)
dbClearResult(res)
dbDisconnect(con)
d2 <- devices %>% pivot_wider(names_from = location, values_from = freq)