R code on Google docs

后端 未结 4 1015
既然无缘
既然无缘 2021-02-10 02:47

I\'m aware that you can publish spreadsheets on Google docs and then import them in R. However, let\'s say I have a function or some code I want to read in R (like in the sourc

4条回答
  •  旧巷少年郎
    2021-02-10 03:17

    It is most easily done with Dropbox - see here http://thebiobucket.blogspot.co.at/2012/05/source-r-script-from-dropbox.html

    like so:

    source("http://dl.dropbox.com/s/c18lcwnnrodsevt/test_dropbox_source.R")
    

    But you can either do it with Googledocs, like here http://thebiobucket.blogspot.co.at/2011/11/how-to-run-r-scripts-directly-out-of.html#more

    library(RCurl)
    setwd(tempdir())
    destfile = "test_google_docs.txt"
    x = getBinaryURL("https://docs.google.com/uc?export=download&id=0B2wAunwURQNsMDViYzllMTMtNjllZS00ZTc4LTgzMzEtNDFjMWQ3MTUzYTRk", followlocation = TRUE, ssl.verifypeer = FALSE)
    writeBin(x, destfile, useBytes = TRUE)
    source(paste(tempdir(), "/test_google_docs.txt", sep = ""))
    

提交回复
热议问题