Skip to content

Instantly share code, notes, and snippets.

@renato04
Created June 5, 2019 23:25
Show Gist options
  • Save renato04/dc4755905bb54b1e0f380f157fb866e8 to your computer and use it in GitHub Desktop.
Save renato04/dc4755905bb54b1e0f380f157fb866e8 to your computer and use it in GitHub Desktop.
How to download a write a file using R?
download = function(f){
if(!file.exists('data')){
dir.create('data')
}
file.local = file.path('./data', basename(f))
if(!file.exists(file.local)){
download.file(url = f, destfile = file.local , mode='wb')
}
}
download("https://raw.githubusercontent.com/elthonf/fiap-mba-r/master/data/Copas.csv")
download("https://raw.githubusercontent.com/elthonf/fiap-mba-r/master/data/Copas-Partidas.csv")
download("https://raw.githubusercontent.com/elthonf/fiap-mba-r/master/data/Copas-Jogadores.csv")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment