filterPoolingData: Filter data to be pooled for meta-analysis

View source: R/filterPoolingData.R

filterPoolingDataR Documentation

Filter data to be pooled for meta-analysis

Description

This convenience function allows to create a filtered data set, which is then ready to be used for meta-analytic pooling.

Usage

filterPoolingData(.data, ...,
                  .filter.missing.rows = FALSE,
                  .es.column = es)

Arguments

.data

A data.frame containing the calculated effect sizes, as created by the calculateEffectSizes function.

...

<dplyr_data_masking>. A number of filtering statements (using variables in .data) that return a logical value. To apply multiple filters, simply separate them using a comma. "OR" statements can be provided using the | operator. Multiple filter statements separated using commas will be combined using the AND (&) operator. See "Details".

.filter.missing.rows

logical. Should rows with no effect sizes be filtered out? Default is FALSE.

.es.column

Name of the column in .data to be used for filtering out rows with no effect sizes. Default is es.

Details

The filterPoolingData function allows to apply several filters to your meta-analysis data set all at once. When used in a pipe (%>%), you only need to supply several filtering statements separated by commas, using the same column names as they appear in the data set (e.g. primary == 1, meanage == 58). The filtering statements are then connected using "AND" (&).

If you want to apply an "OR" filter, simply use | instead of a comma (e.g. type == "cbt" | format == 6). To select all rows that contain one of several values in a variable, use %in%; e.g. study %in% c("Bailey, 2017", "Barth 2005").

The Detect function can be used within the function call to search for variable elements which contain one or several selected words (separated by |). To include all rows which contain the word "cbt" or "wl" or "cau" in the "Cond_spec_trt2" variable, we can use Detect(Cond_spect_trt2, "cbt|wl|cau"). This will also filter out elements like "cbt (online)", because "cbt" is included.

For more details see the help vignette: vignette("metapsyTools").

Value

filterPoolingData returns the filtered data set as class data.frame. The filtered data set should then be ready for meta-analytic pooling, for example using metagen.

Author(s)

Mathias Harrer mathias.h.harrer@gmail.com, Paula Kuper paula.r.kuper@gmail.com, Pim Cuijpers p.cuijpers@vu.nl

See Also

filterPriorityRule

Examples

## Not run: 

# Example 1: calculate effect sizes and then use multiple AND filters.
data("inpatients")
inpatients %>%
    expandMultiarmTrials() %>%
    calculateEffectSizes() %>%
    filterPoolingData(primary == 1, Outc_measure == "hamd")

# Example 2: use OR filter
inpatients %>%
    expandMultiarmTrials() %>%
    calculateEffectSizes() %>%
    filterPoolingData(primary == 1 | Outc_measure == "hamd")

# Example 3: use %in% operator
inpatients %>%
    expandMultiarmTrials() %>%
    calculateEffectSizes() %>%
    filterPoolingData(Outc_measure %in% c("hamd", "bdi-ii"))

# Example 4: Search for studies using "fuzzy-ish" matching
data("psyCtrSubset")
psyCtrSubset %>%
  expandMultiarmTrials() %>%
  calculateEffectSizes() %>%
  filterPoolingData(Detect(Cond_spec_trt1 , "cbt|sup"),
                    Detect(Cond_spec_trt2 , "wl|cau"),
                    !study %in% "Heckman, 2011")

## End(Not run)


MathiasHarrer/metapsyTools documentation built on May 1, 2022, 5:14 p.m.