RE: [R] Splitting vector into individual elements

2004-09-15 Thread Liaw, Andy
do.call() is good for this, I believe: offred.rgb - c(1, 0, 0) * 0.60 offred.col - do.call(rgb, c(as.list(offred.rgb), names=offred)) offred.col [1] #99 HTH, Andy From: Paul Roebuck Is there a means to split a vector into its individual elements without going the brute-force route

Re: [R] Splitting vector into individual elements

2004-09-15 Thread Spencer Graves
Have you considered do.call: do.call(rgb, as.list((1:3)/10)) [1] #1A334C same as: rgb(.1, .2, .3) [1] #1A334C Hope this helps. spencer graves Paul Roebuck wrote: Is there a means to split a vector into its individual elements without going the brute-force route for arguments to a

Re: [R] Splitting vector into individual elements

2004-09-15 Thread Gabor Grothendieck
Paul Roebuck roebuck at odin.mdacc.tmc.edu writes: : Is there a means to split a vector into its individual : elements without going the brute-force route for arguments : to a predefined function call? : : offred.rgb - c(1, 0, 0) * 0.60; : : ## Brute force style : offred.col -

Re: [R] Splitting vector into individual elements

2004-09-15 Thread John Fox
Dear Paul, How about do.call(rgb, as.list(offred.rgb)) ? I hope that this helps, John On Wed, 15 Sep 2004 15:20:24 -0500 (CDT) Paul Roebuck [EMAIL PROTECTED] wrote: Is there a means to split a vector into its individual elements without going the brute-force route for arguments to a

Re: [R] Splitting vector into individual elements

2004-09-15 Thread Peter Dalgaard
Paul Roebuck [EMAIL PROTECTED] writes: Is there a means to split a vector into its individual elements without going the brute-force route for arguments to a predefined function call? offred.rgb - c(1, 0, 0) * 0.60; ## Brute force style offred.col - rgb(offred.rgb[1],

Re: [R] Splitting vector into individual elements

2004-09-15 Thread Paul Roebuck
On Wed, 15 Sep 2004, Peter Dalgaard wrote: Paul Roebuck [EMAIL PROTECTED] writes: Is there a means to split a vector into its individual elements without going the brute-force route for arguments to a predefined function call? offred.rgb - c(1, 0, 0) * 0.60; ## Brute force

RE: [R] Splitting vector into individual elements

2004-09-15 Thread Liaw, Andy
From: Paul Roebuck On Wed, 15 Sep 2004, Peter Dalgaard wrote: Paul Roebuck [EMAIL PROTECTED] writes: Is there a means to split a vector into its individual elements without going the brute-force route for arguments to a predefined function call? offred.rgb - c(1, 0, 0)

Re: [R] Splitting vector into individual elements

2004-09-15 Thread Peter Dalgaard
Paul Roebuck [EMAIL PROTECTED] writes: Everyone offered 'do.call' as the solution. While that works, is it to say that there is no means of expanding the expression as an argument to the original function? Not really. You need an explicit expansion of the argument to a list somehow, and

RE: [R] Splitting vector into individual elements

2004-09-15 Thread Liaw, Andy
From: Liaw, Andy From: Paul Roebuck On Wed, 15 Sep 2004, Peter Dalgaard wrote: Paul Roebuck [EMAIL PROTECTED] writes: Is there a means to split a vector into its individual elements without going the brute-force route for arguments to a predefined function call?

Re: [R] Splitting vector into individual elements

2004-09-15 Thread Spencer Graves
Slightly more transparent but arguably uglier: offred.rgb - c(1, 0, 0) * 0.60 ofr - paste(offred.rgb, collapse=,) ofr. - paste(rgb(, ofr, ',names=offred)') ofr. [1] rgb( 0.6,0,0 ,names=\offred\) eval(parse(text=ofr.)) offred #99 As long as I can remember eval(parse(text=, this

Re: [R] Splitting vector into individual elements

2004-09-15 Thread Gabor Grothendieck
Gabor Grothendieck ggrothendieck at myway.com writes: : : Paul Roebuck roebuck at odin.mdacc.tmc.edu writes: : : : : : On Wed, 15 Sep 2004, Peter Dalgaard wrote: : : : : Paul Roebuck roebuck at odin.mdacc.tmc.edu writes: : : : : Is there a means to split a vector into its individual : :