[Rd] Symbol and Ellipsis problems

Thomas McCallum termcc at googlemail.com
Tue Mar 20 11:36:09 CET 2007


Hi Everyone,

When I have a load of functions which have various arguments passed
via the ellipsis argument it keeps on assigning them as symbol making
them unusable to the function.  My current work around involves using
do.call but this is rather cumbersome.

Does anyone know why it suddenly changes the types to symbol and if
there is a way to get the actual data pointed to by the symbol? (I
have tried eval but that does not work and most functions just treat a
symbol as a string).

( An example which shows the type conversion is given below with the
output - the key is the following "dataX=data" which makes the object
data passed as a symbol and not the actual data).

Many thanks

Tom

====EXAMPLE CODE====
data=c(1,2,3,4,5,6,7,8,9);

x <- function( ... ) {
        args <- list();
        extras <- match.call(expand.dots = FALSE)$...;
        for( i in names(extras) ) {
                args[[ i ]] <- extras[[ i ]];
                print(args[[i]]);
                print(typeof(extras[[i]]));
        }


}

cat("TYPE OF DATA:");
print(typeof(data));
x(dataX=data);



More information about the R-devel mailing list