Dear All,

I need to write 'n' functions on 'm' variables. The functions should be
constructed according to the values of an (nxm) matrix of '1/0' values as
follows. For example,

if row1 is equal to ,say [1 0  .......0 0] then f1 <- (1+x1)
if row 2 is equal to, say [1 1 1 0...0 1] then f2
<-(1+x1)*(1+x2)*(1+x3)*(1+xm)
if row n is equal to [0 1 0 1 1 0 ..... 0] then fn <-(1+x2)*(1+x4)*(1+x5)

Is there an efficient way to write these functions? Note that each f(x) is a
function of m variables, independently on whether the function explicitly
includes a given variable or not.

Many thanks for your help!

Regards,

Lars.

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to