Azure / Microsoft365R

R SDK for interacting with Microsoft 365 APIs
Other
313 stars 44 forks source link

Directly loading RData files from SharePoint #142

Closed martinpastoors closed 1 year ago

martinpastoors commented 1 year ago

Hello, is it possible to directly load a RData file that is stored on a SharePoint system directly into RStudio? We are keeping data within RData files and we would like to be able to directly load that information into memory. So far, I have only been able to download the file and then open it locally, but that is a procedure that we are trying to avoid as we don't want local copies of the files on sharepoint. Hope that you could provide some guidance on this.

hongooi73 commented 1 year ago

This is (relatively) straightforward with an rds file; you can load that into an in-memory connection rather than saving it to disk. It's trickier with an rdata file, because the file can contain multiple R objects.

The way you'd do it is by downloading the file using download_file() into a connection, and then running load() with that connection as the first argument. I can add the first part as a new feature for Microsoft365R, but I think the second part is something best handled by the end-user.

hongooi73 commented 1 year ago

You can now save and load rds and rdata files with the save_rds, load_rds, save_rdata and load_rdata methods. These are available for drives and drive items. See ?ms_drive and ?ms_drive_item for more info.