We can analyze global case data reported for coronavirus disease (CoViD-19) from the repository of the Johns Hopkins University Center for Science and Systems Engineering (JHU CSSE) https://github.com/CSSEGISandData/COVID -19

Data sets are available in two modalities, such as time series sequences and based on the person's status (confirmed, deceased, or recovered).

Thanks to this package we have several analysis, visualization and modeling functions available that will allow us to calculate and visualize the total number of cases, the total number of changes and the growth rate worldwide or for a specific geographic location.

We even have to generate the Susceptible-Infected-Recovered (SIR) model for the spread of the disease. (beta)

A fantastic resource implemented in R library to be able to work in class with completely updated data and pre-designed models, with simple lines of code will allow us to study the data in a simple and visual way.

After this brief introduction of how this library works, I want to add in this article some commands and functionalities to see it in a much more practical way.

We install the library in our R environment

Install.packages(“covid19.analytics”)

We load the library to use it

library(covid19.analytics)

Now that we are ready we can start using the data.

The function covid19.data () allows users to obtain real-time data on the cases reported by CoViD19 from the JSE's CCSE repository, in the following ways:

  • "Aggregated" for the last day, with great 'granularity' of geographic regions (ie cities, provinces, states, countries)
  • Time series for larger cumulative geographic regions (provinces / countries)
  • "Deprecated": We also include the original data style in which these data sets were initially reported.

The data sets also include information on the different 'confirmed' / 'deaths' / 'recovered' categories (status) of daily reported cases by country / region / city.

Example

#get in “data” all the current data of COVID19 in all registered cities

data <- covid19.data()

View (data)

We will obtain by time sequence all the data confirmed by COVID19

data_c <- covid19.data(case="ts-confirmed")

View (data_c)

Remember that we can play with these time sequences and the different states.

Time series data
ts-confirmed Confirmed data
ts-deaths Deceased data
ts-recovered Recovered data
ts-ALL Combined data

A quick function to view top cases by region for time series and aggregated records

report.summary ()

Example from Spain

report.summary(geo.loc="Spain")

We compare the first two cities in the USA

report.summary(Nentries=2, geo.loc="US")

We can output the confirmed totals by region along a timeline

data_c <- covid19.data(case="ts-confirmed")

tots.per.location(data_c, geo.loc = "US")

Growth rate in Italy of deceased cases.

data_d <- covid19.data(case="ts-deaths")

growth.rate(data_d, geo.loc = "Italy")

Live Maps

Data of deceased worldwide

data_d <- covid19.data(case="ts-deaths")

live.map(data_d)

And to finish this list of examples we can use the SIR.model command to generate our epidemiological model.

#SIR

data_c <- covid19.data(case="ts-confirmed")

generate.SIR.model(data_c, "Spain", tot.population = 46490000)

With this little help article I wanted to show you this useful library where in a simple way and without having much knowledge of R we can generate interesting data models.

If you want to investigate and advance further in this bookstore, here are the references.

https://github.com/mponce0/covid19.analytics

https://cran.r-project.org/web/packages/covid19.analytics/index.html