Description Usage Arguments Value Examples
View source: R/quest_functions.R
make.product
creates product terms (i.e., interactions) from various
components. make.product
uses Center
for the optional of
centering and/or scaling the predictors and/or moderators before making the
product terms.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
data |
data.frame of data. |
x.nm |
character vector of colnames from |
m.nm |
character vector of colnames from |
center.x |
logical vector of length 1 specifying whether the predictor columns should be grand-mean centered before making the product terms. |
center.m |
logical vector of length 1 specifying whether the moderator columns should be grand-mean centered before making the product terms. |
scale.x |
logical vector of length 1 specifying whether the predictor columns should be grand-SD scaled before making the product terms. |
scale.m |
logical vector of length 1 specifying whether the moderator columns should be grand-SD scaled before making the product terms. |
suffix.x |
character vector of length 1 specifying any suffix to add to
the end of the predictor colnames |
suffix.m |
character vector of length 1 specifying any suffix to add to
the end of the moderator colnames |
sep |
character vector of length 1 specifying the string to connect
|
combo |
logical vector of length 1 specifying whether all combinations
of the predictors and moderators should be calculated or only those in
parallel to each other (i.e., |
data.frame with product terms (e.g., interactions) as columns. The
colnames are created by paste(paste0(x.nm, suffix.x), paste0(m.nm,
suffix.m), sep = sep)
.
1 2 3 4 5 6 7 | make.product(data = attitude, x.nm = c("complaints","privileges"),
m.nm = "learning", center.x = TRUE, center.m = TRUE,
suffix.x = "_c", suffix.m = "_c") # with grand-mean centering
make.product(data = attitude, x.nm = c("complaints","privileges"),
m.nm = c("learning","raises"), combo = TRUE) # all possible combinations
make.product(data = attitude, x.nm = c("complaints","privileges"),
m.nm = c("learning","raises"), combo = FALSE) # only combinations "in parallel"
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.