score_control() adds a variable, score, that summarizes how well a study controls for a domain or construct. Used to sort heatmaps and traffic light plots.

score_control(.df, score = c("adequate", "sum", "controlled"))

Arguments

.df

A data frame, usually the result of metaconfoundr()

score

The approach used to calculate the score. adequate tests if the study controlled at a strictly adequate level. sum treats control_quality as an ordinal integer, summing it's values such that a higher score has better control overall. controlled tests if any control, including some concerns control, is present.

Value

a tibble

Examples

library(dplyr)
#> 
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’:
#> 
#>     filter, lag
#> The following objects are masked from ‘package:base’:
#> 
#>     intersect, setdiff, setequal, union

ipi %>%
  metaconfoundr() %>%
  filter(is_confounder == "Y") %>%
  score_control("controlled") %>%
  arrange(desc(score))
#> # A tibble: 319 × 6
#>    construct         variable     is_confounder study        control_qua…¹ score
#>    <chr>             <chr>        <chr>         <chr>        <ord>         <dbl>
#>  1 Sociodemographics Maternal age Y             Zhu_2001a    adequate          1
#>  2 Sociodemographics Maternal age Y             Zhu_2001b    adequate          1
#>  3 Sociodemographics Maternal age Y             Zhu_1999     adequate          1
#>  4 Sociodemographics Maternal age Y             Smith_2003   adequate          1
#>  5 Sociodemographics Maternal age Y             Shachar_2016 adequate          1
#>  6 Sociodemographics Maternal age Y             Salihu_2012a adequate          1
#>  7 Sociodemographics Maternal age Y             Salihu_2012b adequate          1
#>  8 Sociodemographics Maternal age Y             Hanley_2017  adequate          1
#>  9 Sociodemographics Maternal age Y             deWeger_2011 adequate          1
#> 10 Sociodemographics Maternal age Y             Coo_2017     adequate          1
#> # … with 309 more rows, and abbreviated variable name ¹​control_quality