auto_factor_point_to: Create a Matrix for 'factor_point_to'

View source: R/auto_factor_point_to.R

auto_factor_point_toR Documentation

Create a Matrix for 'factor_point_to'

Description

Use a named vector or named arguments to create a matrix of the directions of indicators of factors.

Usage

auto_factor_point_to(factor_layout, ...)

Arguments

factor_layout

Argument description.

...

Additional arguments. If the first argument is not named, then it should be a named vector of directions, names being the names of the factors, and directions can be one of these values: "up", "down", "left", "right". Other arguments are ignored. If the arguments are named, then the names of the arguments are the names of the factors, and the argument values are the direction for the factors.

Details

A helper function to make it easier to create the matrix used by set_sem_layout() to indicate where the indicators of each factor should be positioned.

It works in two modes. If the first argument is a named vector, such as c(f1 = "up", f2 = "down"), then this vector will be used to create the direction matrix.

If the arguments are named, such as ⁠auto_factor_point_to(factor_layout, f1 = "up", f2 = "down"⁠, then the names are treated as the factor names, and the values of the arguments are treated as the directions.

The matrix created can then be used for the argument factor_point_to in set_sem_layout().

Value

A character matrix of the same dimension as factor_layout. The cells of factor names are replaced by the directions to place their indicators.

See Also

set_sem_layout()

Examples

factor_layout <- matrix(c("f1",   NA,   NA,
                            NA, "f3", "f4",
                          "f2",   NA,   NA), byrow = TRUE, 3, 3)
factor_point_to <- auto_factor_point_to(factor_layout,
                                        f1 = "left",
                                        f2 = "left",
                                        f3 = "down",
                                        f4 = "down")
factor_point_to

semptools documentation built on Oct. 15, 2023, 5:07 p.m.