2

I saved a dataset in a RDS file on onedrive and made it shareable link. Now, if I use that link to read the file, I got an error.

readRDS(url("https://1drv.ms/u/s!Am3aUTxhPMS8iM4pqe5fUZbiA4m9rw"))
#> Error in readRDS(url("https://1drv.ms/u/s!Am3aUTxhPMS8iM4pqe5fUZbiA4m9rw")): unknown input format

On the other hand, if I download the file from the browser, I copy the link address and I use that one...that works.

Unfortunately, the link address obtained in that way is available only for a limited time (it doesn't work permanently).

I know googledrive and rdrop2 and so I have some workarounds, but still...I don't understand the logic behind this. Any help?

c1au61o_HH
  • 867
  • 7
  • 14
  • shouldn't you use `readRDS`? – Wimpel Nov 18 '19 at 08:04
  • My apologies, I meant to write readRDS... – c1au61o_HH Nov 18 '19 at 09:12
  • does this link do some sort of redirection? try downloading the url without any redirections or scripts, e.g. by using curl. – snaut Nov 18 '19 at 09:56
  • Search on the internet, you'll find how to generate a direct downloadable link for a one drive file... Last I remember , copy and customize the the `iframe` link will do that, which you can call from your rscript. – deepseefan Nov 18 '19 at 10:11
  • Unfortunately, neither those solutions work. In both cases you end up downloading a string ( "/var/folders/yc/gsp94d0x6nvcgb__spc0p6lm0000gn/T//RtmpkGptu4/filebad934576c0a", the path on the server?) and not the actual file. I think we need something along the lines of what @lukeA has shown for gdrive here https://stackoverflow.com/questions/33135060/read-csv-file-hosted-on-google-drive#33142446) – c1au61o_HH Nov 19 '19 at 05:56
  • I tried to adapt that example to onedrive but I was unsuccessful – c1au61o_HH Nov 19 '19 at 05:57

0 Answers0