#### Analysis of Variance

KEY:

ds = dataset you are currently using.

DV = dependent variable of interest

IV = independent variable of interest

Subject = name of subject number column

XYXY = dummy name for a variable, matrix, or data frame into which you are moving information.

## Before performing ANOVA: Make your subjects and IVs into factors

Note that in ANOVA your independent variables and subject numbers (within-subjects data) need to be treated as discrete levels. R assumes that subject numbers are continuous. In order to tell it otherwise, use the factor function.

_____________________________

ds$Subject <- as.factor(ds$Subject)

ds$IV <- as.factor(ds$IV)

_____________________________

You can also use this command to add labels to your IVs if you desire

_____________________________

ds$IV <- factor(ds$IV,

levels = c(0,1),

labels = c("Label for 0", "Label for 1"))

_____________________________