arrange_data.Rd
This function takes wide format free recall data where all responses are stored in the same cell and converts it to long format.
arrange_data(data, responses, sep, id, repeated = NULL)
a dataframe of the variables you would like to return. Other variables will be included in the returned output in long format if they represent a one to one match with the participant ID. If you have repeated data, please use the repeated argument or run this function several times for each trial.
a column name in the dataframe that contains the participant answers for each item in quotes (i.e., "column")
a character separating each response in quotes - example: ",".
a column name containing participant ID numbers from the original dataframe
(optional) a single column name or set of columns that indicate repeated measures columns you would like to keep with the data. You should include all columns that are not a one to one match with the subject ID (i.e., participants saw multiple trials). Please see our vignette for an example.
A dataframe of the participant answers including:
The participant id number
The participant response
The position number of the response listed
Any additional columns included
#This dataset includes a subject number, set of answers, and
#experiment condition.
data(wide_data)
DF_long <- arrange_data(
data = wide_data,
responses = "Response",
sep = ",",
id = "Sub.ID")
head(DF_long)
#> Sub.ID response position Disease.Condition
#> 1 1 basket 1 healthy
#> 2 1 chair 2 healthy
#> 3 1 clothes 3 healthy
#> 4 1 flowrs 4 healthy
#> 5 1 glasses 5 healthy
#> 6 1 fan 6 healthy