long_format: Convert to long format

View source: R/long_format.R

long_formatR Documentation

Convert to long format

Description

Converts the generated stimuli from the generate() function into long format.

Usage

long_format(df, include = "design", include_candids = FALSE)

Arguments

df

A data frame that is the result from control_for() or split_by().

include

A string indicating whether the long-format result should include all variables in the original data frame ("all"), only those specified by split_by() and control_for() ("design"), only those specified in split_by() ("splits"), or only those specified by control_for() ("controls"). Set to NA for only the data in the wide-format data frame. The default is "design".

include_candids

Logical; whether to include data about unused candidates in the result. If TRUE, will store whether each word was actually used in column, is_stim. Default is FALSE.

Value

Returns the generated stimuli, but converted into long format, containing requested variables from the original df, and the variables of item_nr, condition, euclidean_distance (from the match_null).

Examples


lexops |>
  split_by(Syllables.CMU, 1:3 ~ 4:6 ~ 7:20) |>
  control_for(Zipf.SUBTLEX_UK, -0.2:0.2) |>
  generate(n = 20) |>
  long_format(include = "all")


JackEdTaylor/LexOPS documentation built on Oct. 11, 2024, 10:38 p.m.