Can I use R to transfer non R files to a data base?

I have files, created outside R (e.g. Modde files, .mip or similar non R files), that I want to transfer to a data base as a BLOB vector, using R as a conduite only. I do not need to translate these files into a format that R understands. Ultimately, I would like to build a shiny interface to do this.

Is there a way to read any file into R as a binary vector, that then can be sent to a sql data base as a blob?

Any insights or pointers are highly appreciated.

Jannik

Hi,

I don't fully underderstand what you're going for, but maybe reading the files in as raw binary data and then writing it to the DB using R might work. Take a look at the readRaw function of the hexView package

https://www.rdocumentation.org/packages/hexView/versions/0.3-4/topics/readRaw

This discussion on loading binary files into postrgres might be of interest

1 Like

Thanks, pieter

Im currently on vacation, so It is not possible for me to test your suggestion, but as I understand it, readRaw, would let me read ANY filetype (whether .txt, .jpg, ....) into a binary representation in R, which would then allow me to store this as a blob in a data base - correct?

Thanks

Jannik

Hi,

I have never used this package or saved BLOB data, so I guess you'll have to try it out and let us know if it works!

Good luck,
PJ

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.