| as_ternable | R Documentation |
Creates a ternable object, which contains observation coordinates, simplex vertices, and edges necessary for building a ternary plot in both two and higher dimensions.
as_ternable(
data,
items = dplyr::everything(),
group = NULL,
order_by = NULL,
decreasing = FALSE,
na_method = c("drop_na", "drop_group"),
...
)
data |
A data frame containing the item (alternative) columns used to construct the ternary plot. |
items |
< |
group |
Optional column name indicating the grouping variable. If specified, the data will be grouped by this variable. This is useful for creating paths between observations within each group. |
order_by |
Optional column name indicating the order variable. If specified, the data will be ordered by this variable. This is useful for creating paths between observations within each group. |
decreasing |
Logical. If |
na_method |
Character string specifying how to handle missing values in
|
... |
Additional arguments (currently unused, reserved for future extensions). |
A ternable object (S3 class) containing:
data |
: The validated and normalized data frame |
data_coord |
: Transformed coordinates for all observations |
data_edges |
: Edge connections for drawing paths between observations |
simplex_vertices |
: Vertex coordinates and labels for the simplex |
simplex_edges |
: Edge connections for drawing the simplex boundary |
vertex_labels |
: Labels of the vertices, same as names of the selected item columns |
# Load and transform the dataset
prefviz::aecdop25_transformed
# Create the ternable object
tern <- as_ternable(prefviz::aecdop25_transformed, items = ALP:IND)
tern
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.