| MatchedDataFrame-class {nullranges} | R Documentation |
The MatchedDataFrame class is a subclass of both
Matched and DFrame. Therefore, it contains slots
and methods for both of these classes.
The MatchedDataFrame class uses a delegate object
during initialization to assign its DFrame slots.
MatchedDataFrame behaves as a DataFrame but also
includes additional Matched object functionality
(see ?Matched). For more information about
DataFrame see ?S4Vectors::DataFrame.
focalA DataFrame object containing the focal
data to match.
poolA DataFrame object containing the pool
from which to select matches.
delegateA DataFrame object used to initialize
DataFrame-specific slots. matchRanges() assigns
the matched set to the slot.
matchedDataA data.table with matched data
matchedIndexAn integer vector corresponding
to the indices in the pool which comprise the
matched set.
covarA character vector describing the covariates used for matching.
methodCharacter describing replacement method used for matching.
replaceTRUE/FALSE describing if matching was done with or without replacement.
rownamesrownames(delegate)
nrowsnrows(delegate)
listDataas.list(delegate)
elementTypeelementType(delegate)
elementMetadataelementMetadata(delegate)
metadatametadata(delegate)
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.
Additional functions that get data from Matched subclasses
(x) such as MatchedDataFrame, MatchedGRanges,
and MatchedGInteractions include:
focal(x): Get focal set from a Matched object
pool(x): Get pool set from a Matched object
matched(x): Get matched set from a Matched object
unmatched(x): Get unmatched set from a Matched object
For more detail check the help pages for these functions.
matchedData, covariates, method, withReplacement, indices
focal, pool, matched, unmatched
## Constructing MatchedDataFrame with matchRanges ## data.frame set.seed(123) x <- makeExampleMatchedDataSet(type = "data.frame") mx <- matchRanges( focal = x[x$feature1, ], pool = x[!x$feature1, ], covar = ~ feature2 + feature3, method = "rejection", replace = FALSE ) class(mx) ## data.table set.seed(123) x <- makeExampleMatchedDataSet(type = "data.table") mx <- matchRanges( focal = x[x$feature1], pool = x[!x$feature1], covar = ~ feature2 + feature3, method = "rejection", replace = FALSE ) class(mx) ## DataFrame set.seed(123) x <- makeExampleMatchedDataSet(type = "DataFrame") mx <- matchRanges( focal = x[x$feature1, ], pool = x[!x$feature1, ], covar = ~ feature2 + feature3, method = "rejection", replace = FALSE ) class(mx) ## Make MatchedDataFrame example set.seed(123) x <- makeExampleMatchedDataSet(type = "DataFrame", matched = TRUE) ## Accessor functions for Matched class matchedData(x) covariates(x) method(x) withReplacement(x) head(indices(x, set = 'matched')) ## Accessor functions for Matched subclasses focal(x) pool(x) matched(x) unmatched(x)