简体   繁体   中英

Reading dput() gists from github into R

I am trying to read a gist containing a dput from Github:

library(RCurl)
data <- getURL("https://gist.githubusercontent.com/aronlindberg/848b8efef154d0e7fdb4/raw/5bf4bb864cc4c1db0f66da1be85515b4fa19bf6b/pull_lists")
pull_lists <- dget(textConnection(data))

This generates:

Error: '\U' used without hex digits in character string starting ""@@ -1,7 +1,9 @@
 module ActionDispatch
   module Http
     module URL
-      # Returns the complete \U"

Which I think is a Ruby error message rather than an R error. Now consider this:

data <- getURL("https://gist.githubusercontent.com/aronlindberg/b6b934b39e3c3378c3b2/raw/9b1efe9340c5b1c8acfdc90741260d1d554b2af0/data")
 pull_lists2 <- dget(textConnection(data))

This seems to work fine. The former gist is rather large, 1.7mb. Could this be why I can't read it from Github. If not, why?

The gist that you created does not have a .R file in it, since pull_lists does not have an extension. I forked your gist to this one and added the extension. Now it is possible to source the gist and save it to a value.

library("devtools")
pull_lists <- source_gist("a7b157cec3b9259fc5d1")

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