Joris Meys
2011-Dec-08 14:53 UTC
[Rd] object type changes after being used as an argument in .Internal(paste(...))
OK, I realize I'm hacking away in R in a manner that was not intended, but I found this interesting behaviour nonetheless, and I am not sure whether this was intended to be so or not.> x <- list(1:3,1:3,1:3) > r1 <- do.call(paste,x) # the correct way > sapply(x,typeof)[1] "integer" "integer" "integer"> r2 <- .Internal(paste(x,sep=" ",collapse=NULL)) > sapply(x,typeof)[1] "character" "character" "character" So although I don't change x explicitly, after the call to .Internal(paste(...)) it suddenly is a list of characters instead of integers. Is this supposed to happen? (Normally .Internal(paste(...)) takes an anonymous list(...) as argument, so it might very well be the intended way of working.) Cheers Joris -- Joris Meys Statistical consultant Ghent University Faculty of Bioscience Engineering Department of Mathematical Modelling, Statistics and Bio-Informatics tel : +32 9 264 59 87 Joris.Meys at Ugent.be ------------------------------- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php