Skip to contents

This function takes a dataframe as input (this will typically be params data.frame from the output of load_epidata) and reorders it to provide a sensible order for plotting. For each country, studies are ordered by the parameter value or the midpoint of the parameter range if the parameter value is missing. It creates a new column 'y' which is an ordered factor with levels corresponding to the article_label. To order the studies in some other way, set reorder_studies to FALSE in the parameter specific forest plot functions (e.g. forest_plot_rt).

Usage

reorder_studies(df)

Arguments

df

The input dataframe to be reordered

Value

The reordered dataframe

Examples

ebola <- load_epidata("ebola")
#> Warning: One or more parsing issues, call `problems()` on your data frame for details,
#> e.g.:
#>   dat <- vroom(...)
#>   problems(dat)
#> Warning: No data found for  ebola
#> Warning: One or more parsing issues, call `problems()` on your data frame for details,
#> e.g.:
#>   dat <- vroom(...)
#>   problems(dat)
#> Warning: No outbreaks information found for  ebola
#> Data loaded for ebola
params <- ebola$params
rt <- params[params$parameter_type == "Reproduction number (Effective, Re)", ]

reorder_studies(param_pm_uncertainty(rt))
#> # A tibble: 91 × 82
#>    id     parameter_data_id covidence_id pathogen parameter_type parameter_value
#>    <chr>  <chr>                    <int> <chr>    <chr>                    <dbl>
#>  1 472ee… a97b0a0cd787228e…        23719 Ebola v… Reproduction …            0.33
#>  2 f22ca… baf56944162b6acc…          404 Ebola v… Reproduction …            0.73
#>  3 59052… f09308ea7f9dfa18…        17881 Ebola v… Reproduction …           NA   
#>  4 54159… 9254ff2db0ac53e8…         3138 Ebola v… Reproduction …            0.84
#>  5 d03ce… 028c5c53f6ba5d73…        19035 Ebola v… Reproduction …            0.9 
#>  6 aca68… 0fdc709369f7d292…         6003 Ebola v… Reproduction …            1.03
#>  7 59052… bd021cac38430bdf…        17881 Ebola v… Reproduction …            1.03
#>  8 07c43… dd6de5f34483b208…        17206 Ebola v… Reproduction …            1.06
#>  9 59544… 94e97cdb2fcc3029…        19291 Ebola v… Reproduction …            1.11
#> 10 8d70f… fd15f4e8f5d66c97…        17192 Ebola v… Reproduction …            1.14
#> # ℹ 81 more rows
#> # ℹ 76 more variables: exponent <dbl>, parameter_unit <chr>,
#> #   parameter_lower_bound <dbl>, parameter_upper_bound <dbl>,
#> #   parameter_value_type <chr>, parameter_uncertainty_single_value <dbl>,
#> #   parameter_uncertainty_singe_type <chr>,
#> #   parameter_uncertainty_lower_value <dbl>,
#> #   parameter_uncertainty_upper_value <dbl>, …