[R] add transformed columns into a matrix

From: Luke <jyzz88_at_gmail.com>
Date: Tue 28 Jun 2005 - 14:51:34 EST


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



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Jun 28 14:57:42 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:03 EST