Last active
June 6, 2019 00:18
-
-
Save LetticiaNicoli/f51d2e44bba6c23883da724dad10dcc5 to your computer and use it in GitHub Desktop.
R - Obtendo dados
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Obtendo dados com o R | |
pathName = "C:/Users/logonrmlocal/Documents/Aula/data"; | |
#Download | |
dir.create(pathName) | |
file.url = 'http://www.bcb.gov.br/pec/Indeco/Port/IE1-04.xlsx' | |
file.local = file.path('./Aula/data', basename(file.url)) | |
download.file(url = file.url, destfile = file.local , mode='wb') | |
#Function Download | |
funcDownload = function(link){ | |
if(!file.exists(pathName)){ | |
dir.create(pathName) | |
} | |
file.local = file.path('./Aula/data', basename(link)) | |
download.file(url = link, destfile = file.local , mode='wb') | |
} | |
funcDownload("https://raw.githubusercontent.com/elthonf/fiap-mba-r/master/data/Copas.csv") | |
funcDownload("https://raw.githubusercontent.com/elthonf/fiap-mba-r/master/data/Copas-Partidas.csv") | |
funcDownload("https://raw.githubusercontent.com/elthonf/fiap-mba-r/master/data/Copas-Jogadores.csv") | |
#Read File | |
copasRead = read.table('Aula/data/Copas.csv') | |
library(readr) | |
Copas <- read_csv("Aula/data/Copas.csv") | |
View(Copas) | |
partidas = read.table('Aula/data/Copas-Partidas.csv',fill = TRUE) | |
#Fill corrige campos nao preenchidos | |
View(partidas) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment