Awesome, thanks!
On Wed, Nov 10, 2021 at 10:33 PM Rasmus Liland wrote:
>
> Dear Luigi,
>
> Yes, from the named list of dataframes,
> you access the demographic table like
> that.
>
> You can remove dput() now, I used it
> only to print the output; read ?dput,
> it's very handy the next time you
Dear Luigi,
Yes, from the named list of dataframes,
you access the demographic table like
that.
You can remove dput() now, I used it
only to print the output; read ?dput,
it's very handy the next time you ask
questions on this list.
Take a closer look at my obfuscated code
... To
I tried this:
```
x = dput(sapply(names(ODB::odb.tables(db)), function(tbl) {
sqlQuery <- paste0('SELECT * FROM "', demographic, '"')
ODB::odb.read(db, sqlQuery)
}, simplify=F))
y = x$demographic
```
so now `y` is the dataframe for the table `demographic`:
```
> y
ID Study_ID Hosp_ID
On 2021-11-10 18:55 +0100, Luigi Marongiu wrote:
> no, it worked. that table was indeed
> empty and you for the right entries on
> the other table. I'll try on my
> machine, thank you!
Cheers man!
signature.asc
Description: PGP signature
__
Dear Luigi,
I tried quoting ... This:
odb = ODB::odb.open("proof.odb", jarFile = NULL)
dput(sapply(names(ODB::odb.tables(odb)), function(tbl) {
sqlQuery <- paste0('SELECT * FROM "', tbl, '"')
ODB::odb.read(odb, sqlQuery)
}, simplify=F))
Sure! I am attaching a simplified version of it. I did not see the
quote text; it might be difficult to call all table's names since
there are hundreds of columns..
On Wed, Nov 10, 2021 at 4:15 PM Rasmus Liland wrote:
>
> Are you willing to send me a part of the
> the proof.odb so I can run the
also Note in ?ODB::odb.read says:
To query databases built with OpenOffice
or LibreOffice, it may be necessary to
quote table and/or column names in
‘sqlQuery’, as the default behavior of
the HSQL engine is to convert unquoted
table and
Are you willing to send me a part of the
the proof.odb so I can run the query? R
signature.asc
Description: PGP signature
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read
Thank you.
I have used ODB, it looks easier to use (and install since it needs
way fewer dependencies than odbc) but I can't run the SQL statement:
```
> library(ODB)
Loading required package: DBI
Loading required package: RJDBC
Loading required package: rJava
> db = odb.open("proof.odb", jarFile
Dear Luigi,
I found the package ODB
https://cran.r-project.org/web/packages/ODB/ODB.pdf
and was able to install it after
reconfiguring rJava ...
The help page ?ODB::odb.open has this
example:
odbFile <- tempfile(fileext=".odb")
odb.create(odbFile, overwrite="do")
how can I connect to a LibreOffice base odb file using the package odbc for R?
I tried with:
> library(odbc)
> library(DBI)
> con <- dbConnect(odbc::odbc(),
+ driver = "PostgreSQL Driver",
+ database = "proof.odb",
+ uid = "",
+
11 matches
Mail list logo