Description Usage Arguments Value Note
View source: R/tdmPreprocUtils.r
Given the data frame dset
and a data frame rx
with the same number of rows,
add monomials of degree 2 to dset for all quadratic combinations of the first PRE.npc
columns of rx
. The naming of these new columns is "R1x2" for the combination of cols
1 and 2 and so on (if prefix="R").
1 | tdmPreAddMonomials(dset, rx, PRE.npc, opts, degree = 2, prefix = "R")
|
dset |
the target data frame |
rx |
a data frame where to draw the monomials from |
PRE.npc |
the number of columns from |
opts |
a list from which we need here the following entries:
|
degree |
[2] (currently only 2 is supported) |
prefix |
["R"] character prefix for the monomial column names |
data frame dset
with the new monomial columns appended. If
PRE.npc==0, the data frame is returned unchanged.
CAVEAT: The double for-loop costs some time (e.g. 2-4 sec for ncol(rx)=8 or 10) How to fix: make a version w/o for-loop and w/o frequent assigns to dset (**TODO**)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.