Dear R users,
My input is a matrix. The matrx rows are sample; the matrix columns
are features. I need an output matrix which include the original
features and some kinds of transformed features. For example, there
are only three features x1, x2, and x3 in my original matrix (input
matrix). The features of output matrix consist of base feature
"block", interaction terms "block", log-transformed feature
"block",
etc., i.e., the features of output matrix are:
x1, x2, x3, x1:x2, x1:x3, x2:x3, log(x1), log(x2), log(x3), sqrt(x1),
sqrt(x2), sqrt(x3), ...
Is there any handy method in R to expand the matrix in this way?
Thanks,
-Luke