Apply a function on an array with the parameter as an array
You can do something like this:
lapply(1:nrow(X), function(.indx, param){
X[.indx,] * param[.indx] # apply param[i] to row i of X
}, param=arrayOf Params)
On Tue, Jan 26, 2010 at 3:52 PM, anna <lippelanna24 at hotmail.com> wrote:
Ok, I read the entire posting guide and updated my signature. So I come back on my question, should I use an apply in an apply to make this? ----- Anna Lippel -- View this message in context: http://n4.nabble.com/Apply-a-function-on-an-array-with-the-parameter-as-an-array-tp1310834p1310922.html Sent from the R help mailing list archive at Nabble.com.
______________________________________________ R-help at 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.
Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve?