poset_from_dataframe: Generates a Partially Ordered SET from a data frame through...

View source: R/poset_from_dataframe.R

poset_from_dataframeR Documentation

Generates a Partially Ordered SET from a data frame through the component-wise comparability relation

Description

This function generates a poset from an object x of class data.frame that lists by rows all the observations in a statistical population and by columns the values of different orderable variables (i.e. vectors of class ordered or numeric).

Usage

poset_from_dataframe(x, collapse = "-")

Arguments

x

an object of class data.frame.

collapse

an object of class character that defines the separator between observations with the same profile, by default "-". For more information see the details section.

Details

The poset is generated through the component-wise comparability relation \insertCitedavey2002introductionPOSetR. Note that some observations may have the same profile (i.e. the same values for all the variables) therefore they have to be included into the same element of the poset, than the label of such element correspond to the labels of the statistical units separated by the collapse character.

Value

an S4 object of class Rcpp_POSet; this class contains different C++ methods used by other functions of the package.

References

\insertRef

davey2002introductionPOSetR

See Also

poset.

Examples

set <- ordered(letters[1:5])
set.seed(0)
n <- 30
x <- data.frame(
  A = sample(set, n, replace = TRUE),
  B = sample(set, n, replace = TRUE),
  C = sample(set, n, replace = TRUE)
)

p <- poset_from_dataframe(x, collapse = ",")

plot(p, equispaced = TRUE, vertex.frame.color = "lightgray", vertex.color = "lightgray")

POSetR documentation built on Jan. 17, 2023, 5:18 p.m.