Search code examples
rdata.table

upload data from github


jhu_cases <- as.data.frame(data.table::fread("https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_19-covid-Confirmed.csv"))

I tired also

jhu_cases <- as.data.frame(data.table::fread("https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_19-covid-Confirmed.csv",
                                         header = TRUE, sep = ",", sep2 = "/"))

seems doesnt work, many thanks in advance


Solution

  • Had the same problem, it's because they've changed the names of the csv., solved this way:

    #traer datos de john hopkins
    Main<- "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series"
    
    
    #guardar los links a varios CSV separados
    confirmed_Path <- file.path(Main, "time_series_covid19_confirmed_global.csv")
    death_Path <- file.path(Main, "time_series_covid19_deaths_global.csv")
    recovered_Path <- file.path(Main, "time_series_covid19_recovered_global.csv")
    
    #leer los datos incluidos en cada csv
    ConfirmedData <- read.csv(confirmed_Path, stringsAsFactors = FALSE)
    DeathData <- read.csv(death_Path, stringsAsFactors = FALSE)
    RecoveredData <- read.csv(recovered_Path, stringsAsFactors = FALSE)