This convenience function works with output from [EstZoonoticTB]{link_data}
to extract
the most recent data from each country for a given variable
get_latest_data(data, variable = NULL)
data | Dataframe containing variables to be mapped. Must contain a |
---|---|
variable | An unquoted variable name to select the most recent data for. |
A tibble containing the most recent estimates, by country, of the proportion of TB cases that are zoonotic
## Extract linked data df <- link_data(verbose = FALSE) ## Extract most recent study data get_latest_data(df, tb_z_prop)#> # A tibble: 50 x 26 #> country country_code g_whoregion year tb_cases tb_inc tb_inc_lo tb_inc_hi #> <chr> <fct> <fct> <dbl> <int> <dbl> <dbl> <dbl> #> 1 Argent… ARG Americas 2006 11000 28 24 33 #> 2 Austra… AUS Western Pa… 2007 1300 6.2 5.3 7.1 #> 3 Austria AUT Europe 2007 930 11 9.6 13 #> 4 Belgium BEL Europe 2007 1100 10 8.8 12 #> 5 Bulgar… BGR Europe 2007 3600 47 36 59 #> 6 Burkin… BFA Africa 2001 8200 69 44 98 #> 7 Burundi BDI Africa 1994 NA NA NA NA #> 8 Camero… CMR Africa 1998 NA NA NA NA #> 9 Chad TCD Africa 2002 14000 152 99 218 #> 10 China CHN Western Pa… 2007 1140000 85 71 100 #> # … with 40 more rows, and 18 more variables: prop_tb_ep <dbl>, prop_hiv <dbl>, #> # prop_hiv_lo <dbl>, prop_hiv_hi <dbl>, z_tb_dom_animal <fct>, #> # z_tb_wild_animal <fct>, z_tb_id <int>, z_tb_geo_coverage <fct>, #> # z_tb_study_pop <fct>, z_tb_multi_year_study <fct>, tb_z_prop <dbl>, #> # tb_z_prop_lo <dbl>, tb_z_prop_hi <dbl>, tb_z_prop_se <dbl>, #> # population <dbl>, prop_rural <dbl>, cattle <int>, cattle_per_head <dbl>