How to use R with Google Colaboratory?

后端 未结 6 1481
误落风尘
误落风尘 2020-11-29 16:59

Google Colaboratory supports Python version 2.7 and 3.6

I see an example how to use Swift in Colab a while ago.

Today, I happened to run

!jup         


        
6条回答
  •  温柔的废话
    2020-11-29 17:28

    *****Working as of Friday 13th November 2020

    Go this URL https://colab.to/r whilst signed into colab and that should do it.

    You can check if R in Runtime -> Change runtime type, but it should already be setup.

    To mount google drive:

    install.packages("googledrive")
    library("googledrive")
    
    if (file.exists("/usr/local/lib/python3.6/dist-packages/google/colab/_ipython.py")){ 
      install.packages("R.utils")
      library("R.utils")
      library("httr")
      my_check <- function() {return(TRUE)}
      reassignInPackage("is_interactive", pkgName = "httr", my_check)
      options(rlang_interactive=TRUE)
    }                                                                                    
    

    And authenticate google drive

    drive_auth(use_oob = TRUE, cache = TRUE)
    

提交回复
热议问题