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
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
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 -
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
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],
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
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)
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
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?
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
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
: :
11 matches
Mail list logo