Reading OneDrive files to R

前端 未结 4 1974
离开以前
离开以前 2020-12-20 20:44

When I read in csv files from Dropbox into R, I right-click the file and click share Dropbox link. I then have a URL something like:

4条回答
  •  没有蜡笔的小新
    2020-12-20 21:07

    None of those answers work for me, but I found an alternative solution that works.

    • Find the file in OneDrive online using Chrome.
    • Share it to anyone with the link.
    • Right click the … and select “download”.
    • Let the file download.
    • Press Ctrl + J to open the Downloads page in Chrome.
    • Find the link on that page for the file.

    Use the following code to download the file.

    read_url_csv <- function(url, ...){
      tmpFile <- tempfile()
      download.file(url, destfile = tmpFile)
      url_csv <- readr::read_csv(tmpFile, ...)
      return(url_csv)
    }
    onedrive_url <- "INSERT LINK COPIED ABOVE"
    csv <- read_url_csv(onedrive)
    
    

提交回复
热议问题