简体   繁体   中英

Error in readRDS

I'm running R v3.4.3 and I see an error when I try to read a publicly available rds file.

>githubURL<-("https://github.com/ChongWu-Biostat/aSPUpath2/blob/master/Example/example.stat.rds")
>download.file(githubURL,"example.stat.rds", method="curl")
>example.stat<-readRDS("example.stat.rds")
Error in readRDS("example.stat.rds") : unknown input format

That URL points to the web page for that file. You've downloaded the HTML and tried to load that as a .RDS. If you look at the .RDS file you'll see.

You really want the URL for the raw data:

> url = "https://raw.githubusercontent.com/ChongWu-Biostat/aSPUpath2/master/Example/example.stat.rds"
> download.file(url,"example.stat.rds", method="curl")
[download progress...]
> example.stat<-readRDS("example.stat.rds")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM