You can pass it:
NextMethod("fn", x = uniqueFoo2, common = common)
On Tue, Apr 27, 2010 at 10:42 PM, Wincent wrote:
> Thanks Gabor.
>
> Still, there is one problem. If the common argument is
> common=c("opt1","opt2") and I want to use match.arg(common) in side
> fn.foo1, then an error is encount
Thanks Gabor.
Still, there is one problem. If the common argument is
common=c("opt1","opt2") and I want to use match.arg(common) in side
fn.foo1, then an error is encountered.
fn <- function(x,...) UseMethod("fn")
fn.default <-
fn.foo1 <- function(x, common=c("opt1","opt2"), ...) {
match
Define fn.default as a synonym to fn.foo1 (or just rename fn.foo1 as
fn.default) and then use NextMethod as shown:
fn <- function(x,...) UseMethod("fn")
fn.default <-
fn.foo1 <- function(x, commonA=1, ...) {
print("fn.foo1 is called.")
}
fn.foo2 <- function(x, uniqueFoo2, common=1, ...){
Dear all, I have define a function and its methods as follows:
beginning of code
fn <- function(x,...){
UseMethod("fn")
}
fn.foo1 <- function(x, commonA=1, ...){
print("fn.foo1 is called.")
}
fn.foo2 <- function(x, uniqueFoo2, common=1, ...){
## uniqueFoo2 is a unique argument in fn.fo
4 matches
Mail list logo