Learn R Programming

obfuscatoR (version 0.2.2)

extract_attr: Extract attributes

Description

Extracts the attributes of objects nested in a list

Usage

extract_attr(x, str_attr)

Value

Returns a list the length of x containing the specified attribute. If the attribute does not exist, returns NULL

Arguments

x

A list of objects with attributes or an object with an attribute

str_attr

A non-empty character string specifying which attribute is to be extracted

Examples

Run this code
design_opt_input <- list(rules = 4, actions = 5)
design <- generate_designs(design_opt_input)
extract_attr(design, "design_conditions")

design_opt_input <- list(rules = 4, actions = 5, designs = 2)
design <- generate_designs(design_opt_input)
extract_attr(design, "design_conditions")

Run the code above in your browser using DataLab