[R] Using two (...) in a function

Márcio Resende mresendeufv at yahoo.com.br
Tue Dec 1 14:30:08 CET 2009


Hello R-Helpers,
I am not sure if it is a very simple question but I would like to use two
(...) in a function, for example,

this is a script where I would like to input the variable names (in one of
the (...)) and the variances associated to those variables which are not
calculated in the script because there is a specific software to calculate
it (the other (...))

data <- function ("DAP", "ALT", var1, var2){  #### My wish was to do
somethin like function (...,...){
Vec <- matrix(c("DAP", "ALT"))    ###here it would came the first (...) Vec
<- matrix(c(...))
for (i in seq(along <- Vec)){
caracteristica <- Vec[i]

varF <- if (caracteristica == "DAP") var1 else var2    ##here I would like
to do something like #if   ###caracteristica == variable1) variance1 else if
(caracteristica == variable2) variance2 else ...
}
}

but to turn this in a function, I would like to replace ("DAP", "ALT") by
any variable and var1, var2 to any variance, and not only necessary 2, for
example
data ("variable1","variable2","variable3", "variance1", "variance2",
"variance3")

I am not sure if I made myself clear and if this is an "answerable" doubt,
anyway thank you vey much
Márcio
-- 
View this message in context: http://n4.nabble.com/Using-two-in-a-function-tp932200p932200.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list