[R] Determine the data type of a function to an argument

Alex Restrepo alex_restrepo at hotmail.com
Tue Jun 20 22:48:03 CEST 2006

Hello All:

How can I determing the "types" of args passed to an R function?  For 
example, given the following:

    calculate <- function(...)
        args <- list(...)
        argName     = names(args)

        if (arg1 == character)
            cat("arg1 is a character")
             cat("arg1 is numeric")

        if (arg2 == character)
            cat("arg2 is a character")
            cat("arg2 is a numeric")

    value = calculate(arg1='222' arg2=333)

Programatically, how can I determine if arg1 is a character and arg2 is 

Many Thanks:


More information about the R-help mailing list