Learn R Programming

HuraultMisc (version 1.1.1)

extract_index_nd: 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

Run this code
# NOT RUN {
extract_index_nd(c("sigma", "sigma[1]", "sigma[1, 1]", "sigma[1][2]"))
# }

Run the code above in your browser using DataLab