poset_from_dataframe {POSetR}R 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 (Davey and Priestley 2002). 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

Davey BA, Priestley HA (2002). Introduction to lattices and order. Cambridge university press.

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")

[Package POSetR version 1.1.4 Index]