Displaying 6 results from an estimated 6 matches for "dbgetresult".
2004 Jan 12
1
extract data from a data.frame
Hi,
I'm reading part of a table from postgres, so I'm
getting a data frame.
how can I extract the numerica values so I can
operate on them.
> res <- dbGetResult(mydata)
> str(res)
`data.frame': 5 obs. of 8 variables:
$ cyx.1: num 0.149 -0.278 0.114 0.060 0.109
$ cyx.2: num 0.158 -0.070 0.063 0.149 0.150
$ cyx.3: num 0.052 -0.350 0.114 0.126 0.238
$ cyx.4: num 0.085 -0.009 0.097 0.121 0.258
$ cyx.5: num 0.131 -0.028 0.0...
2009 Sep 13
2
zoo plot: yearly marks on X-Axis
...t;,
user="postgres", password = "******")
query_duj_kal <- dbSendQuery(conn, "select zdroj as well, cas as date,
fe2, fe3, mn, nh4, no2, no3, o2, teplota as temperature from analystats
where zdroj like 'Dunaj Kalinkovo' order by date")
watchem_duj_kal <- dbGetResult(query_duj_kal)
date <- (watchem_duj_kal$date)
date_p <- strptime(date, "%m-%d-%Y")
no3 <- (watchem_duj_kal$no3)
nh4 <- (watchem_duj_kal$nh4)
par(mfrow=c(3,1), ylog = TRUE, yaxp = c(0.01, 100, 3))
maxy <- 100
miny <- 0.005
plot(date_p, no3,log = "y", type = &q...
2009 Jan 13
0
crash on multiple queries to postgresql db [solved]
...lan Beaudette wrote:
>>>>
>>>> Subsequent calls to:
>>>>
>>>> conn <- dbConnect(PgSQL(), host="localhost", dbname="xxx", user="xxx")
>>>> query <- dbSendQuery(conn, query_text)
>>>> res <- dbGetResult(query)
>>>>
>>>> are resulting in this:
>>>>
>>>> *** glibc detected *** /usr/local/lib/R/bin/exec/R: realloc(): invalid
>>>>
>>>> other attached packages:
>>>> [1] RdbiPgSQL_1.8.0 Rdbi_1.8.0 lattice_0.17-20
&g...
2009 Sep 11
1
format (?) problems with data imported from postgres
..."BVS",
user="postgres", password = "*******")
query_duj_kal <- dbSendQuery(conn, "select zdroj as well, cas as date,
fe2, fe3, mn, nh4, no2, no3, o2, teplota as temperature from analystats
where zdroj like 'Dunaj Kalinkovo'")
watchem_duj_kal <- dbGetResult(query_duj_kal)
My intention with the data is to create a time series by a following
script:
date <- (watchem_duj_kal$date)
NO3 <- (watchem_duj_kal$no3)
NH4 <- (watchem_duj_kal$nh4)
maxy<-max(NO3,NH4)
miny<-min(NO3[NO3>0],NH4[NH4>0])
date_p <- as.POS...
2002 Feb 26
1
Cross-tabulation of data from database
...species in the square in %. I
want to have the dataset transformed into a table similiar to the example
tables in vegan, i.e, one column for each species, one row for each square.
What I have done so far is to establish a connection to postgres using Rdbi,
fetching the data :
> dca.raw<-dbGetResult(dcaq)
> dca.raw
nornavn dekningsgrad ruteid
1 Fjellmarik?pe 1 LIASB01
2 Gulaks 3 LIASB01
3 Harerug...
2011 Mar 18
0
apply function returning different results
...ll.hits
return (P.hit)
} else{
return (-miss)
}
}
query.db <- function(dxdf){
snquery = dbSendQuery(connection, paste("select distinct cpt4code from
DxRxLookup where icd9code = '", dxdf[4], "'", sep = ""))
cptcodes <<- dbGetResult(snquery)
#restrict this to constrain by Rx1 and Rx2 inputs
h1 <<- which(cpt$Cpt %in% cptcodes[,1])
y <<- which((cpt$Rx2 %in% dxdf[2] | cpt$Rx1 %in% dxdf[2]) & (cpt$Rx1
%in% dxdf[3] | cpt$Rx2 %in% dxdf[3]))
hits <<- intersect(y, h1)
sum.all.hits <<- s...