context {matrixset}R Documentation

Contexts dependent functions

Description

These functions are designed to work inside certain matrixset functions, to have access to current group/matrix/row/column. Because of that, they will not work in a general context.

The functions within which the context functions will work are apply_matrix(), apply_row() and apply_column() - as well as their *_dfl/*dfw variant.

Note that "current" refers to the current matrix/group/row/column, as applicable, and possibly combined.

The context functions are:

Usage

current_row_info()

current_column_info()

current_n_row()

current_n_column()

current_row_name()

row_pos()

row_rel_pos()

current_column_name()

column_pos()

column_rel_pos()

Value

See each individual functions for returned value when used in proper context. If used out of context, an error condition is issued.

Examples

# this will fail (as it should), because it is used out of context
is(try(current_n_row(), silent = TRUE), "try-error")

# this is one way to know the number of students per class in 'student_results'
student_results |>
    apply_matrix_dfl(n = ~ current_n_row(), .matrix = 1)


[Package matrixset version 0.3.0 Index]