extract_index_nd: Extract multiple indices inside bracket(s) as a list

View source: R/utility_functions.R

extract_index_ndR Documentation

Extract multiple indices inside bracket(s) as a list

Description

Extract multiple indices inside bracket(s) as a list

Usage

extract_index_nd(x, dim_names = NULL)

Arguments

x

Character vector.

dim_names

Optional character vector of dimension names. If dim_names is not NULL, if the elements of x don't have the same number of indices, the missing indices will be set to NA.

Value

Dataframe with columns:

  • Variable, containing x where brackets have been removed

  • Index, a list containing values within the brackets. If dim_names is not NULL, Index is replaced by columns with names dim_names containing numeric values.

Examples

extract_index_nd(c("sigma", "sigma[1]", "sigma[1, 1]", "sigma[1][2]"))

ghurault/HuraultMisc documentation built on Dec. 9, 2024, 10:39 a.m.