[Rd] object type changes after being used as an argument in .Internal(paste(...))

From: Joris Meys <jorismeys_at_gmail.com>
Date: Thu, 08 Dec 2011 15:53:55 +0100

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.)


Joris Meys
Statistical consultant

Ghent University
Faculty of Bioscience Engineering
Department of Mathematical Modelling, Statistics and Bio-Informatics

tel : +32 9 264 59 87
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

R-devel_at_r-project.org mailing list
Received on Thu 08 Dec 2011 - 14:58:16 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 08 Dec 2011 - 18:30:16 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive