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

Rasmus Liland jr@| @end|ng |rom po@teo@no
Wed Nov 10 17:23:06 CET 2021


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))
	
	ODB::odb.close(odb, write=FALSE)

Yields this:

	list(day = structure(list(day_ID = c(0, 1, 2, 3, 4, 5, 6, 7,
	8, 9, 10, 11, 12, 13, 14, 15, 16, 17), Day = c(1, 2, 3, 5, 7,
	9, 11, 13, 14, 16, 18, 20, 22, 24, 26, 28, 30, 31)), row.names = c(NA,
	18L), class = "data.frame"), demographic = structure(list(ID = logical(0),
	    Study_ID = logical(0), Hosp_ID = logical(0), Hospital = logical(0),
	    Address = logical(0), Occ_ID = logical(0), Age = logical(0),
	    Sex = logical(0)), row.names = c(NA, 0L), class = "data.frame"),
	    hospitals = structure(list(Hosp_ID = c(0, 1, 2, 3), Hospital = c("Fatebenefratelli",
	    "Royal Free", "Santa Croce in Gerusalemme", "Sagrada Familia"
	    ), Address = c("Via Tiberina", "Tottenham Court road", "Via Latina",
	    "Barcelona")), row.names = c(NA, 4L), class = "data.frame"))

The demographics table is empty, but has 
headers ....  Maybe you selected the 
wrong file ...

Best,
Rasmus

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20211110/25874b15/attachment.sig>


More information about the R-help mailing list