2020 has been the year of COVID19 Pandemic. This article will help one get live COVID19 worldwide data using an R package called “covid19.analytics”. The datasets in this package are available in two main modalities, as a time series sequences and aggregated for the last day with greater spatial resolution.
The covid19.data() function allows users to obtain realtime data about the CoViD19 reported cases from the JHU’s CCSE repository, in the following modalities:
“aggregated” data for the latest day, with a great ‘granularity’ of geographical regions (ie. cities, provinces, states, countries)
“time series” data for larger accumulated geographical regions (provinces/countries)
“deprecated”: we also include the original data style in which these datasets were reported initially. The datasets also include information about the different categories (status) “confirmed”/“deaths”/“recovered” of the cases reported daily per country/region/city.
This data-acquisition function, will first attempt to retrieve the data directly from the JHU repository with the latest updates. If for what ever reason this fails (eg. problems with the connection) the package will load a preserved “image” of the data which is not the latest one but it will still allow the user to explore this older dataset. In this way, the package offers a more robust and resilient approach to the quite dynamical situation with respect to data availability and integrity.
Data retrieval options
#Install and Load package
install.packages("covid19.analytics")
library(covid19.analytics)
# reads the latest aggregated data
covid19.ALL.agg.cases <- covid19.data("aggregated")
# obtain time series data for "confirmed" cases
covid19.confirmed.cases <- covid19.data("ts-confirmed")
# reads time series data for casualties
covid19.TS.deaths <- covid19.data("ts-deaths")
# reads all possible datasets, returning a list
covid19.all.datasets <- covid19.data("ALL")
# read the time series data for all the cases(confirmed, death, recovery data)
all.data <- covid19.data('ts-ALL')
head(all.data[,1:6])
Province.State Country.Region Lat Long 2020-01-22 2020-01-23
1 Afghanistan 33.93911 67.70995 0 0
2 Albania 41.15330 20.16830 0 0
3 Algeria 28.03390 1.65960 0 0
4 Andorra 42.50630 1.52180 0 0
5 Angola -11.20270 17.87390 0 0
6 Antigua and Barbuda 17.06080 -61.79640 0 0
Here we are showing only first 6 columns out of all columns
This is how one can get covid19 live data in R.
Note : Data is available from 22nd Jan, 2020 till date
One can also get interactive plots using functions like total.plts() & live.map()
#Interactive plot of total number of cases per day
totals.plt(all.data)
#Interactive map displaying cases around the world
live.map(all.data)