0

I am attempting to load a .Rdata file without having to download the actual file to my computer.

Here is what I have so far:

primate_URL <- "https://ftp.ncbi.nlm.nih.gov/geo/series/GSE118nnn/GSE118546/suppl/GSE118546_macaque_fovea_all_10X_Jan2018.Rdata.gz"
con <- gzcon(url(primate_URL))
load(con)

When I run the script, it returns this error:

Error in load(con) : 
  the input does not start with a magic number compatible with loading from a connection

Any tips on what I might be doing wrong?

Nold
  • 60
  • 1
  • 7
  • @akrun I attempted your method, and it loaded something, although it looks to be corrupted: https://imgur.com/c97eBya – Nold Aug 08 '20 at 20:59
  • I didn't download it fully as it was a big file. – akrun Aug 08 '20 at 20:59
  • sorry, forgot it is `.Rdata` – akrun Aug 08 '20 at 21:00
  • btw, I'm trying to load the file into memory without downloading to my computer. I'm looking for something similar to this post [here](http://stackoverflow.com/a/55308162/12212260). – Nold Aug 10 '20 at 21:19

1 Answers1

0

Try following. I tried it with a small file from the same source of same type.

primate_URL <- "https://ftp.ncbi.nlm.nih.gov/geo/series/GSE118nnn/GSE118992/suppl/GSE118992_supplementaryData.Rdata.gz"

download.file(primate_URL, "GSE118992_supplementaryData.Rdata.gz")

file.x <- gzfile("GSE118992_supplementaryData.Rdata.gz", open = "r")
file.x.data <- readLines(file.x, encoding="UTF-8")
dataENQ
  • 29
  • 4
  • I was hoping to load the file directly into memory, similar to this post for csv files: https://stackoverflow.com/a/55308162/12212260. – Nold Aug 10 '20 at 21:17