The Matched class is a container for attributes of covariate-matched data resulting from matchRanges().

Slots

matchedData

A data.table with matched data

matchedIndex

An integer vector corresponding to the indices in the pool which comprise the matched set.

covar

A character vector describing the covariates used for matching.

method

Character describing replacement method used for matching.

replace

TRUE/FALSE describing if matching was done with or without replacement.

Accessor methods for Matched Class

Functions that get data from Matched subclasses (x) such as MatchedDataFrame, MatchedGRanges, and MatchedGInteractions are listed below:

  • matchedData(x): Get matched data from a Matched object

  • covariates(x): Get covariates from a Matched object

  • method(x): Get matching method used for Matched object

  • withReplacement(x): Get replace method

  • indices(x, set): Get indices of matched set

For more detail check the help pages for these functions.

Examples

## Make Matched example
set.seed(123)
x <- makeExampleMatchedDataSet(matched = TRUE)
## Accessor functions for Matched class
matchedData(x)
#>        id feature2 feature3         ps       set
#>     1:  1 2.879049        c 0.21095908     focal
#>     2:  1 3.539645        c 0.19210984     focal
#>     3:  1 7.117417        c 0.11193396     focal
#>     4:  1 4.141017        a 0.01771986     focal
#>     5:  1 4.258575        c 0.17308581     focal
#>    ---                                          
#> 20496:  0 1.235781        b 0.08945367 unmatched
#> 20497:  0 1.696712        a 0.02707977 unmatched
#> 20498:  0 6.111404        a 0.01255772 unmatched
#> 20499:  0 2.216575        d 0.07578989 unmatched
#> 20500:  0 5.330029        b 0.04535856 unmatched
covariates(x)
#> [1] "feature2" "feature3"
method(x)
#> [1] "rejection"
withReplacement(x)
#> [1] FALSE
head(indices(x, set = 'matched'))
#> [1] 6100 5198 9886 3619 9077 6763