Displaying 1 result from an estimated 1 matches for "switchme2".
Did you mean:
switchme
2002 Sep 17
1
switch (PR#2033)
...e: Ron Wehrens
Version: 1.5.0
OS: Linux, Solaris, OSF alpha
Submission from: (NULL) (128.95.17.61)
Consider these two functions:
switchme <- function(type, ...) {
switch(type,
E = max(...),
V = length(...),
EII = sum(...),
VII = prod(...),
-100)
}
switchme2 <- function(type, ...) {
switch(type,
V = length(...),
EII = sum(...),
VII = prod(...),
-100)
}
The bottom one does what I expect. The top one only gives one answer,
independent
of the second argument.
> switchme2("V", 1:4)
[1] 4
> switchme2...