set_options: Set options for generating stimuli.

View source: R/set_options.R

set_optionsR Documentation

Set options for generating stimuli.

Description

When the first function called in a generate pipeline, allows the user to set options that will be passed to all subsequent functions in the pipeline.

Usage

set_options(df, id_col = "string", cond_col = "LexOPS_splitCond")

Arguments

df

The dataframe that will be used in the generate pipeline.

id_col

A character vector specifying the column identifying unique observations (e.g. in LexOPS::lexops, the id_col is "string"). If the id_col is not found in df, LexOPS will use row numbers.

cond_col

Prefix with which to name the columns where conditions will be stored (default = "LexOPS_splitCond"). Each time split_by() is run on a dataframe, a new cond_col is added to the data frame, e.g., the first time will add splitCond_A, the second time will add split_cond_B, etc. The default is usually sufficient.

Value

Returns df, with the options stored in the attributes.

Examples


# give a df with "word" as the identifying column
lexops |>
  dplyr::rename(word = string) |>
  # tell LexOPS "word" is the identifying column
  set_options(id_col = "word") |>
  split_by(Syllables.CMU, 1:3 ~ 4:6 ~ 7:20) |>
  control_for(Zipf.SUBTLEX_UK, -0.2:0.2) |>
  generate(n = 20)


JackEdTaylor/LexOPS documentation built on Sept. 10, 2023, 3:09 a.m.