arrange_data {lrd}R Documentation

Arrange Data for Free Recall Scoring

Description

This function takes wide format free recall data where all responses are stored in the same cell and converts it to long format.

Usage

arrange_data(data, responses, sep, id, repeated = NULL)

Arguments

data

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.

responses

a column name in the dataframe that contains the participant answers for each item in quotes (i.e., "column")

sep

a character separating each response in quotes - example: ",".

id

a column name containing participant ID numbers from the original dataframe

repeated

(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.

Value

A dataframe of the participant answers including:

Sub.ID

The participant id number

response

The participant response

position

The position number of the response listed

other

Any additional columns included

Examples


#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)


[Package lrd version 0.1.0 Index]