# NOT RUN {
### Generate a silly determinant structure
detStruct <- determinantStructure('This makes no sense',
list('mpg',
behaviorRegEx = 'mpg'),
determinantVar("Proximal determinant",
"t",
determinantVar("Determinant",
"p",
subdeterminants("Subdeterminants",
"a"))));
### Add the variable names
detStructAddVarNames(detStruct, names(mtcars));
### Add the determinant scale variable to the dataframe
mtcarsPlus <- detStructComputeScales(detStruct, mtcars);
### Show its presence
names(mtcarsPlus);
mean(mtcarsPlus$mpg_Determinant);
# }
Run the code above in your browser using DataLab