add_manual_var: Add a (Categorical) Variable Manually

Description Usage Arguments Value Examples

View source: R/add_manual_var.R

Description

Takes a given dataframe and adds a column for a categorical variable The dataframe must only have entries that would all have the same categorical value (i.e. only one level of the variable can be assigned) This (basically useless and arbitrary) function is for adding a label to individual trials (i.e. marking if a list of trials was in quiet or noise)

Usage

1

Arguments

data

Dataframe. What data you want to use. Data should be in a by-trial format and all trials should have the same condition/level that you want to assign within this dataframe

col

Column Name. What you want the name of your variable to be. MUST BE A STRING/CHARACTER. Will also be the new column name in your dataframe

value

Value you want to assign ALL rows in your dataframe. MUST BE A STRING/CHARACTER.

Value

Returns printed dataframe to console window. Assign to variable to add in workspace

Examples

1
2
CogLAW_with_attribute <- add_manual_var(CogLAW,"Attribute_Type","Familiar")
Will return dataframe with new column labelled "Attribute_Type"

katherinesimeon/HLL documentation built on Aug. 20, 2019, 8:19 a.m.