Hello everyone,
I am trying to write an R script to load sighting data directly from the database into R, i.e. directly from the .mdb file, without the need to export a .csv or .ctx file in between.
Using the RODBC Package, I have no issue accessing the database and can retrieve some data, for example Sightings2/Id, Sightings2/DateCreated…
My 2 issues are with the actual sighting data, stored as Long Binary in the .mdb column BinData. Here is my fetching command, then my issues:
df ← sqlQuery(channel,“SELECT TOP 3 Id, DateCreated, BinData FROM Sighting2 ORDER BY Id;”)
- The data I get back is encoded (I think in ASCII). When I open the data-frame in R-Studio, I get:
as.raw(c(0xe6, 0xf5, 0x64, 0x47, 0xa1, 0x15, 0xbf, […]
In R, I get
e6f56447a115bf48808af673ed7cdcda… (circa 700 characters)
Is there a way to get the data from the .mdb file in a human friendly way?
I guess it could be converted after fetching, but is it possible to fetch it directly readable, so R can fit it into different columns as it get the sightings.
- I added TOP 3 to my query because whenever I tried to fetch more than 3 lines, R and R-studio crash. The LongBin/blob is less than 700 character long for each line, I doubt R is running out of memory.
It would help my colleagues and I greatly if we could make this connection work.
Thank you per advance,
Mathieu