Learn R Programming

covid19.analytics (version 1.0)

growth.rate: function to compute daily changes and "Growth Rates" per location; "Growth Rates" defined as the ratio between changes in consecutive days

Description

function to compute daily changes and "Growth Rates" per location; "Growth Rates" defined as the ratio between changes in consecutive days

Usage

growth.rate(data0, geo.loc = NULL, stride = 1, info = "")

Arguments

data0

data.frame with *time series* data from covid19

geo.loc

list of locations

stride

how frequently to compute the growth rate in units of days

info

additional information to include in plots' title

Value

a list containing two dataframes: one reporting changes on daily baisis and a second one reporting growth rates, for the indicated regions

Examples

Run this code
# NOT RUN {
###\donttest{
# read data for confirmed cases
data <- covid19.data("ts-confirmed")
# compute changes and growth rates per location for all the countries
growth.rate(data)
# compute changes and growth rates per location for 'Italy'
growth.rate(data,geo.loc="Italy")
# compute changes and growth rates per location for 'Italy' and 'Germany'
growth.rate(data,geo.loc=c("Italy","Germany"))
###}
# }

Run the code above in your browser using DataLab