#### Aggregate Data

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.

You have several trials of a dependent variable and you would like to get the mean scores at different levels of the independent variables.

â€‹

Note: "DV1", "DV2", "IV1", "IV2" are names that you are giving to the columns (variables) in the aggregated data set. "DVa", "DVb", "IVa", "IVb" refer to the names in the data set you are collapsing.

_____________________________

XYXY.agg <- aggregate (list (DV1 = ds$DVa, DV2 = ds$DVb),

by = list (Subject = ds$Subject,

IV1 = ds$IVa,

IV2 = ds$IVb),

FUN = mean, na.rm = TRUE)

_____________________________

â€‹

â€‹