Re: [R] how to connect libreoffice base odb using R package odbc?

2021-11-10 Thread Luigi Marongiu
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

Re: [R] how to connect libreoffice base odb using R package odbc?

2021-11-10 Thread Rasmus Liland
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

Re: [R] how to connect libreoffice base odb using R package odbc?

2021-11-10 Thread Luigi Marongiu
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

Re: [R] how to connect libreoffice base odb using R package odbc?

2021-11-10 Thread Rasmus Liland
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 __

Re: [R] how to connect libreoffice base odb using R package odbc?

2021-11-10 Thread Rasmus Liland
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))

Re: [R] how to connect libreoffice base odb using R package odbc?

2021-11-10 Thread Luigi Marongiu
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

Re: [R] how to connect libreoffice base odb using R package odbc?

2021-11-10 Thread Rasmus Liland
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

Re: [R] how to connect libreoffice base odb using R package odbc?

2021-11-10 Thread Rasmus Liland
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

Re: [R] how to connect libreoffice base odb using R package odbc?

2021-11-10 Thread Luigi Marongiu
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

Re: [R] how to connect libreoffice base odb using R package odbc?

2021-11-10 Thread Rasmus Liland
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")

[R] how to connect libreoffice base odb using R package odbc?

2021-11-10 Thread Luigi Marongiu
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 = "", +