Skip to content

COVID19 data for modeling

License

CC0-1.0, CC0-1.0 licenses found

Licenses found

CC0-1.0
LICENSE
CC0-1.0
LICENSE.md
Notifications You must be signed in to change notification settings

Fredo-XVII/R.COVID.19

Repository files navigation

R.COVID.19

R build status AppVeyor build status Github All Releases

The goal of R.COVID.19 is to simply aquire data for the disease COVID 19 from sources that make the data readily available. No promises are made to the validaty of the data as their are many people at the sources working on that. Because these functions link to the sources, the data should update as the sources update. If data is not being generated, please open an issue so that I can look into the broken link. The sources for the data is listed below.

Finally, the John Hopkins data was transposed to be tidy, instead of having dates as columns in a wide dataset. The New York Times data was already in a tidy format. See GitPage site for information of other functions and sources of data.

GitPage Site: https://fredo-xvii.github.io/R.COVID.19/

Installation

You can install the released version of R.COVID.19 from CRAN with: (NOT ON CRAN)

install.packages("R.COVID.19")

And the development version from GitHub with:

install.packages("devtools")
devtools::install_github("Fredo-XVII/R.COVID.19")

Examples

Load libraries:

library(R.COVID.19)
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(magrittr)

COVID-19 data from John Hopkins University Data

Global COVID-19 Data:

confirmed <- R.COVID.19::global_confirmed_daily()
#> Parsed with column specification:
#> cols(
#>   .default = col_double(),
#>   `Province/State` = col_character(),
#>   `Country/Region` = col_character()
#> )
#> See spec(...) for full column specifications.

deaths <- R.COVID.19::global_deaths_daily()
#> Parsed with column specification:
#> cols(
#>   .default = col_double(),
#>   `Province/State` = col_character(),
#>   `Country/Region` = col_character()
#> )
#> See spec(...) for full column specifications.

recovered <- R.COVID.19::global_recovered_daily()
#> Parsed with column specification:
#> cols(
#>   .default = col_double(),
#>   `Province/State` = col_character(),
#>   `Country/Region` = col_character()
#> )
#> See spec(...) for full column specifications.

combo <- confirmed %>% 
  dplyr::left_join(deaths) %>%
  dplyr::left_join(recovered) %>% 
  dplyr::mutate(mortality_rate = round((.$deaths_cases / .$confirmed_cases)*100,2))
#> Joining, by = c("Province/State", "Country/Region", "Lat", "Long", "greg_d")
#> Joining, by = c("Province/State", "Country/Region", "Lat", "Long", "greg_d")

knitr::kable(combo %>% dplyr::filter(`Country/Region` == "US") %>% tail(10), format = "html") %>% 
  kableExtra::kable_styling(bootstrap_options = c("striped"))

Province/State

Country/Region

Lat

Long

greg_d

confirmed_cases

deaths_cases

recovered_cases

mortality_rate

NA

US

40

-100

2/24/21

28309085

506335

0

1.79

NA

US

40

-100

2/25/21

28386492

508673

0

1.79

NA

US

40

-100

2/26/21

28463190

510764

0

1.79

NA

US

40

-100

2/27/21

28527344

512252

0

1.80

NA

US

40

-100

2/28/21

28578548

513291

0

1.80

NA

US

40

-100

3/1/21

28637313

514810

0

1.80

NA

US

40

-100

3/2/21

28694071

516737

0

1.80

NA

US

40

-100

3/3/21

28759980

519205

0

1.81

NA

US

40

-100

3/4/21

28827755

521119

0

1.81

NA

US

40

-100

3/5/21

28894541

522877

0

1.81



US COVID-19 Data with Geographic Data:

us_confirmed <- R.COVID.19::us_geo_confirmed_daily()
#> Parsed with column specification:
#> cols(
#>   .default = col_double(),
#>   iso2 = col_character(),
#>   iso3 = col_character(),
#>   Admin2 = col_character(),
#>   Province_State = col_character(),
#>   Country_Region = col_character(),
#>   Combined_Key = col_character()
#> )
#> See spec(...) for full column specifications.

us_deaths <- R.COVID.19::us_geo_deaths_daily()
#> Parsed with column specification:
#> cols(
#>   .default = col_double(),
#>   iso2 = col_character(),
#>   iso3 = col_character(),
#>   Admin2 = col_character(),
#>   Province_State = col_character(),
#>   Country_Region = col_character(),
#>   Combined_Key = col_character()
#> )
#> See spec(...) for full column specifications.

combo <- us_confirmed %>% dplyr::left_join(us_deaths) %>% 
  dplyr::mutate(mortality_rate = round((.$deaths_cases / .$confirmed_cases)*100,2))
#> Joining, by = c("UID", "iso2", "iso3", "code3", "FIPS", "Admin2", "Province_State", "Country_Region", "Lat", "Long_", "Combined_Key", "greg_d")

knitr::kable(combo %>% 
               dplyr::filter(Province_State == "New York", Admin2 == "New York") %>% 
               tail(5), format = "html") %>% 
  kableExtra::kable_styling(bootstrap_options = c("striped"))

UID

iso2

iso3

code3

FIPS

Admin2

Province_State

Country_Region

Lat

Long_

Combined_Key

greg_d

confirmed_cases

Population

deaths_cases

mortality_rate

84036061

US

USA

840

36061

New York

New York

US

40.76727

-73.97153

New York, New York, US

3/1/21

103922

1628706

3906

3.76

84036061

US

USA

840

36061

New York

New York

US

40.76727

-73.97153

New York, New York, US

3/2/21

104444

1628706

3917

3.75

84036061

US

USA

840

36061

New York

New York

US

40.76727

-73.97153

New York, New York, US

3/3/21

104874

1628706

3940

3.76

84036061

US

USA

840

36061

New York

New York

US

40.76727

-73.97153

New York, New York, US

3/4/21

105491

1628706

3954

3.75

84036061

US

USA

840

36061

New York

New York

US

40.76727

-73.97153

New York, New York, US

3/5/21

106144

1628706

3964

3.73




COVID-19 data from The New York Times, based on reports from state and local health agencies.

US COVID-19 County Data with Geographic Data:

us_co_cases <- R.COVID.19::us_counties_daily() %>% 
  dplyr::mutate(mortality_rate = round((.$deaths / .$cases)*100,2))
#> Parsed with column specification:
#> cols(
#>   date = col_date(format = ""),
#>   county = col_character(),
#>   state = col_character(),
#>   fips = col_character(),
#>   cases = col_double(),
#>   deaths = col_double()
#> )
knitr::kable(us_co_cases %>% dplyr::filter(state == "New York") %>% tail(10), format = "html") %>% 
  kableExtra::kable_styling(bootstrap_options = "striped")

date

county

state

fips

cases

deaths

mortality_rate

2021-02-24

Yates

New York

36123

1011

26

2.57

2021-02-25

Yates

New York

36123

1011

26

2.57

2021-02-26

Yates

New York

36123

1011

26

2.57

2021-02-27

Yates

New York

36123

1014

26

2.56

2021-02-28

Yates

New York

36123

1014

26

2.56

2021-03-01

Yates

New York

36123

1014

26

2.56

2021-03-02

Yates

New York

36123

1015

26

2.56

2021-03-03

Yates

New York

36123

1015

26

2.56

2021-03-04

Yates

New York

36123

1017

26

2.56

2021-03-05

Yates

New York

36123

1022

26

2.54



US COVID-19 State Data with Geographic Data:

us_st_cases <- R.COVID.19::us_states_daily() %>% 
  dplyr::mutate(mortality_rate = round((.$deaths / .$cases)*100,2))
#> Parsed with column specification:
#> cols(
#>   date = col_date(format = ""),
#>   state = col_character(),
#>   fips = col_character(),
#>   cases = col_double(),
#>   deaths = col_double()
#> )
knitr::kable(us_st_cases %>% dplyr::filter(state == "New York") %>% tail(10), format = "html") %>% 
  kableExtra::kable_styling(bootstrap_options = "striped")

date

state

fips

cases

deaths

mortality_rate

2021-02-24

New York

36

1611288

46680

2.90

2021-02-25

New York

36

1620181

46790

2.89

2021-02-26

New York

36

1628255

46914

2.88

2021-02-27

New York

36

1636297

47025

2.87

2021-02-28

New York

36

1644124

47143

2.87

2021-03-01

New York

36

1650560

47247

2.86

2021-03-02

New York

36

1656941

47345

2.86

2021-03-03

New York

36

1663505

47464

2.85

2021-03-04

New York

36

1670973

47565

2.85

2021-03-05

New York

36

1679124

47672

2.84

About

COVID19 data for modeling

Resources

License

CC0-1.0, CC0-1.0 licenses found

Licenses found

CC0-1.0
LICENSE
CC0-1.0
LICENSE.md

Stars

Watchers

Forks

Packages

No packages published

Languages