set_attributes_by_extract: Set attributes to each element of an environment

Description Usage Arguments Author(s) See Also

View source: R/set_attributes_by_extract.R

Description

This function makes use of setattr from the Matthew Dowle's data.table package to set attributes for an an entire environment. The function can extract parts of an object's name and assign it to some attribute. The extraction uses str_extract from Hadley Wickham's stringr package.

Usage

1
2
  set_attributes_by_extract(env, label = "group",
    extract_pattern = "[A-Z]{2}")

Arguments

env

an environment that contains all relevant objects

label

name of the attribute

extract_pattern

regular expression to extract a chunk of the object names

Author(s)

Matthias Bannert

See Also

setattr, str_extract


mbannert/gateveys2 documentation built on May 21, 2019, 2:23 p.m.