Retrieves the daily prevalence of a PANGO lineage(s) by location

getPrevalence(
  pangolin_lineage = NULL,
  location = NULL,
  mutations = NULL,
  cumulative = FALSE,
  logInfo = TRUE
)

Arguments

pangolin_lineage

(optional) PANGO lineage name or vector of PANGO lineage names. Either `pangolin_lineage` or `mutations` needs to be specified. A list of lineages will return a long dataframe with `lineage` as a variable; if you want to calculate the prevalence of lineage1 or lineage2 together, enter the lineages separated by " OR ". For instance, to calculate the prevalence of Delta, you'll need to supply `"B.1.617.2 OR AY.1 OR AY.2 OR ..."` **Be sure to include the space around "OR" and it must be capitalized.**

location

(optional) a location name

mutations

(optional) a `vector` of mutation(s). Either `pangolin_lineage` or `mutations` needs to be specified. Mutations should be specified in the format `gene:mutation`, like "S:E484K"

cumulative

(optional) `Boolean` (T/F), T returns cumulative prevalence since first day of detection

logInfo

(optional) `Boolean` (T/F), T logs helper messages during API calls.

Value

dataframe

Examples

# lineage: P.1 in Brazil
p1_brazil = getPrevalence(pangolin_lineage = "P.1", location = "Brazil")
#> Retrieving data... 

# AY.4, AY.34, and B.1.617.2 in Brazil (AY.4, AY.34, and B.1.617.2 separately)
delta_and_brazil = getPrevalence(pangolin_lineage = c("AY.4", "AY.34", "B.1.617.2"), location = "Brazil")
#> Retrieving data... 
#> Retrieving data... 
#> Retrieving data... 
delta_and_brazil[delta_and_brazil$date == "2021-09-01",]
#>           date total_count lineage_count total_count_rolling
#> 48  2021-09-01         591             0            442.5714
#> 454 2021-09-01         591             0            442.5714
#> 965 2021-09-01         591             2            442.5714
#>     lineage_count_rolling  proportion proportion_ci_lower proportion_ci_upper
#> 48              0.0000000 0.000000000        1.107804e-06         0.005651072
#> 454             0.0000000 0.000000000        1.107804e-06         0.005651072
#> 965             0.8571429 0.001936733        2.436692e-04         0.010501680
#>       lineage location
#> 48       AY.4   Brazil
#> 454     AY.34   Brazil
#> 965 B.1.617.2   Brazil

# AY.4 OR B.1.617.2 in Brazil (AY.4, AY.34 and B.1.617.2 combined)
delta_or_brazil = getPrevalence(pangolin_lineage = "AY.4 OR AY.34 OR B.1.617.2", location = "Brazil")
#> Retrieving data... 
delta_or_brazil[delta_and_brazil$date == "2021-09-01",]
#>           date total_count lineage_count total_count_rolling
#> 48  2021-06-01         636             0            390.4286
#> 454 2022-07-12         370             0            333.8571
#> NA        <NA>          NA            NA                  NA
#>     lineage_count_rolling proportion proportion_ci_lower proportion_ci_upper
#> 48                      0          0        1.258255e-06         0.006416079
#> 454                     0          0        1.469062e-06         0.007486989
#> NA                     NA         NA                  NA                  NA
#>                        lineage location
#> 48  AY.4 OR AY.34 OR B.1.617.2   Brazil
#> 454 AY.4 OR AY.34 OR B.1.617.2   Brazil
#> NA                        <NA>     <NA>

# S:E484K mutation prevalence worldwide
se484k = getPrevalence(mutations = c("S:E484K"))
#> Retrieving data... 

# B.1.1.7 + S:E484K mutation worldwide
b117_se484k = getPrevalence(pangolin_lineage = "B.1.1.7", mutations = c("S:E484K"))
#> Retrieving data...