epa_subset: EPA dictionary search and subset

View source: R/subset.R

epa_subsetR Documentation

EPA dictionary search and subset

Description

Returns a subset of the EPA summary or individual data that fulfills the given parameters. Filtering can be done by term, data set, component (identity, behavior, modifier, setting), type of data (summary or individual), statistics (mean, standard deviation, covariance), institutions the term belongs to, and gender of raters.

Usage

epa_subset(
  expr = ".*",
  exactmatch = FALSE,
  dataset = "everything",
  component = "everything",
  datatype = "summary",
  group = "everything",
  stat = "everything",
  stat_na_exclude = TRUE,
  instcodes = TRUE,
  institutions = "everything",
  drop.na.instcodes = FALSE
)

Arguments

expr

A term, regular expression, or list of terms or regexs to search. If a list is provided, entries will be treated as separated by "or", so all terms matching one or more of the entries will be returned. Default matches all terms.

exactmatch

Logical indicating whether the function should return only exact matches to the expression provided. If FALSE (default), all terms containing the expression are returned.

dataset

The key of the data set (or list of multiple) to search in. Default is "everything". Call dict_info() to see available data sets.

component

The component of the dictionary to use (identity, behavior, modifier, setting). Default is "everything."

datatype

Whether to retrieve summary or individual data. Default is summary.

group

The subgroup of respondents to use. Usually datasets are subgrouped by gender; options are male, female, all. Default is "everything." Ignored when datatype is individual.

stat

The statistics to include in the subset that is returned. Default is all, options are mean, sd (standard deviation), cov (covariance), and n (number of raters). Terms that do not contain values for the required statistic will be excluded from the results. Ignored if datatype is individual.

stat_na_exclude

Ignored if stat is not specified of datatype is individual. A logical indicating whether to exclude entries with NA values for any of the required statistics. Default is TRUE.

instcodes

Logical. Whether to include the institution codes in the output. Default is TRUE.

institutions

Character list. Institutions to include (defaults to everything)

drop.na.instcodes

Logical. When filtering by institution, whether or not to keep terms which have no institution code.

Value

a dataset containing the entries that match the given parameters or FALSE if no matches are found.

Examples

epa_subset("teacher")
epa_subset(dataset = "politics2003")
epa_subset(expr = ".*woman", component = "identity", group = c("male", "female"),
    institutions = c("lay", "business"))
epa_subset(dataset = "morocco2015", stat = "cov", stat_na_exclude = FALSE)
epa_subset(dataset = "usmturk2015", datatype = "individual")

ahcombs/actdata documentation built on Jan. 15, 2025, 6:48 p.m.