Re: [R] Apply a function on an array with the parameter as an array

2010-01-27 Thread Dennis Murphy
Hi: On Tue, Jan 26, 2010 at 1:19 PM, jim holtman wrote: > 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) > > > As a follow-up to Jim's reply, another solution to the problem wh

Re: [R] Apply a function on an array with the parameter as an array

2010-01-26 Thread jim holtman
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 wrote: > > Ok, I read the entire posting guide and updated my signature. So I come back > on my q

Re: [R] Apply a function on an array with the parameter as an array

2010-01-26 Thread anna
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

Re: [R] Apply a function on an array with the parameter as an array

2010-01-26 Thread anna
Sorry! I am reading it now! -- View this message in context: http://n4.nabble.com/Apply-a-function-on-an-array-with-the-parameter-as-an-array-tp1310834p1310856.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mail

Re: [R] Apply a function on an array with the parameter as an array

2010-01-26 Thread Bert Gunter
Speaking **only for myself**, if you don't have the time to read and follow the posting guide, I don't have the time to try to help you. Bert Gunter Genentech Nonclinical Biostatistics __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/li

Re: [R] Apply a function on an array with the parameter as an array

2010-01-26 Thread Bert Gunter
I perhaps should have added that the etiquette of this list is to supply your correct name in your signature. This does not necessarily mean that you will be ignored if you fail to do so, but it does increase the likelihood that you will be. Bert Gunter Genentech Nonclinical Biostatistics __

Re: [R] Apply a function on an array with the parameter as an array

2010-01-26 Thread anna
No the posting guide is quite big and I wanted to take time to read it properly, since I have been posting seriously since last wednesday and I work a lot I didn't get time to do it but will do it now ;). So you say that you know exactly what I tried to do can you explain what I tried to do if it'

Re: [R] Apply a function on an array with the parameter as an array

2010-01-26 Thread Bert Gunter
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of anna Sent: Tuesday, January 26, 2010 11:48 AM To: r-help@r-project.org Subject: [R] Apply a function on an array with the parameter as an array Hello R buddies, I want to apply a

[R] Apply a function on an array with the parameter as an array

2010-01-26 Thread anna
Hello R buddies, I want to apply a function on an array but for each element of the array I want to use a different parameter, So here is how I tried to enter the function: apply(as.matrix(X),2, function, parameter1 = arrayOfParameter) I put X as a matrix because it was initially an element of a l