BradleyTerryScalable (version 0.1.0)

select_components: Subset a btdata object

Description

Subset a btdata object by selecting components from it.

Usage

select_components(btdata, subset, return_graph = FALSE)

Arguments

btdata

An object of class "btdata", typically the result ob of ob <- btdata(..). See btdata.

subset

A condition for selecting a subset of the components. This can either be a character vector of names of the components, a single predicate function (that takes a component as its argument), or a logical vector of the same length as the number of components).

return_graph

Logical. If TRUE, an igraph object representing the comparison graph of the selected components will be returned.

Value

A btdata object, which is a list containing:

wins

A square matrix, where the \(i,j\)-th element is the number of times item \(i\) has beaten item \(j\).

components

A list of the fully-connected components. The names of the list preserve the names of the original btdata object.

graph

The comparison graph of the selected components (if return_graph = TRUE).

See Also

btdata, btfit

Examples

Run this code
toy_df_4col <- codes_to_counts(BradleyTerryScalable::toy_data, c("W1", "W2", "D"))
toy_btdata <- btdata(toy_df_4col)
## The following all return the same component
select_components(toy_btdata, "3", return_graph = TRUE)
select_components(toy_btdata, function(x) length(x) == 4)
select_components(toy_btdata, function(x) "Cyd" %in% x)
select_components(toy_btdata, c(FALSE, FALSE, TRUE))

Run the code above in your browser using DataLab