简体   繁体   English

将Github中的RDS文件导入R Windows

[英]Import RDS file from github into R Windows

I am trying to import a RDS file into RStudio in Windows, I tried following this example , which is for Rdata, and I tried both methods: 我试图在Windows中将RDS文件导入RStudio,我尝试使用此示例 ,这是针对Rdata的,我尝试了两种方法:

Method 1: 方法1:

githubURL <- ("https://github.com/derek-corcoran-barrios/LastBat/blob/master/best2.My.Lu2.rds")
BestMyyu <- readRDS(url(githubURL))

Method 2: 方法2:

githubURL <- ("https://github.com/derek-corcoran-barrios/LastBat/blob/master/best2.My.Lu2.rds")
download.file(githubURL,"best2.My.Lu2.rds")
BestMyyu <- readRDS("best2.My.Lu2.rds")

I've looked for other threads and I have not found any other example 我找了其他线程,我还没有找到任何其他的例子

In 2nd method you just need to add method="curl" and also change the url to point to raw (Download link on the page) 在第二种方法中,你只需要添加method="curl"并将url更改为指向raw (页面上的下载链接)

githubURL <- ("https://raw.githubusercontent.com/derek-corcoran-barrios/LastBat/master/best2.My.Lu2.rds")
download.file(githubURL,"best2.My.Lu2.rds", method="curl")
BestMyyu <- readRDS("best2.My.Lu2.rds")

If you don't have curl installed, you can get it from here 如果您没有安装curl ,可以从这里获取

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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