Update the coronavirus Dataset

While the CRAN version of the package is updated once every month or two, the Github (Dev) version is updating on a daily bases. The following options allow you to keep the data updated with the ones available on the Dev version:

The update_dataset function

The update_dataset function enables to keep the installed version updated with the data available on Github. The function compared between the dataset on the installed version and the ones on the Dev version:

library(coronavirus)

update_dataset()

If no new data is available on the Dev version, the function will return the following message:

No updates are available

Once new data is available, the function will prompt the following question that enables the user to select whether to install the updates from the dev version:

Updates are available on the coronavirus Dev version, do you want to update? n/Y

In order to make the new data available, you will have to restart your R session.

Note: As frequent changes may occur on the raw data structure (such as new fields, retroactive updates in the data, etc.), the Dev version dataset may change accordingly.

Reading the data from CSV version

Alternatively, you can read and load the data directly from the package repository, using the csv version:

library(readr)
coronavirus_df <- read_csv("https://raw.githubusercontent.com/RamiKrispin/coronavirus/master/csv/coronavirus.csv")
## Parsed with column specification:
## cols(
##   date = col_date(format = ""),
##   province = col_character(),
##   country = col_character(),
##   lat = col_double(),
##   long = col_double(),
##   type = col_character(),
##   cases = col_double()
## )
head(coronavirus_df)
## # A tibble: 6 x 7
##   date       province country               lat   long type      cases
##   <date>     <chr>    <chr>               <dbl>  <dbl> <chr>     <dbl>
## 1 2020-01-22 <NA>     Afghanistan          33.9  67.7  confirmed     0
## 2 2020-01-22 <NA>     Albania              41.2  20.2  confirmed     0
## 3 2020-01-22 <NA>     Algeria              28.0   1.66 confirmed     0
## 4 2020-01-22 <NA>     Andorra              42.5   1.52 confirmed     0
## 5 2020-01-22 <NA>     Angola              -11.2  17.9  confirmed     0
## 6 2020-01-22 <NA>     Antigua and Barbuda  17.1 -61.8  confirmed     0