[R] intToUtf8

Duncan Murdoch murdoch at stats.uwo.ca
Fri Sep 19 15:51:00 CEST 2008


On 9/19/2008 9:32 AM, Christian Hennig wrote:
> Hi there,
> 
> any explanation for this?
> 
>> intToUtf8(66)
> Error in intToUtf8(66) : argument 'x' must be an integer vector
>> intToUtf8(c(66,55))
> Error in intToUtf8(c(66, 55)) : argument 'x' must be an integer vector
>> intToUtf8(c(66,55),multiple=TRUE)
> Error in intToUtf8(c(66, 55)) : argument 'x' must be an integer vector
> 
> Errr... 66 and c(66,55) are as integer vectorish as anything can be, aren't 
> they?

No, they're numeric.  "integer" here is a type, not the mathematical 
thing.  This works:

intToUtf8(as.integer(c(66,55)))

The docs don't mention this requirement, and it does seem somewhat 
unnecessary; I'll look into it.


> 
>> version
>                 _
> platform       i686-pc-linux-gnu
> arch           i686
> os             linux-gnu
> system         i686, linux-gnu
> status
> major          2
> minor          6.0
> year           2007
> month          10
> day            03
> svn rev        43063
> language       R
> version.string R version 2.6.0 (2007-10-03)

You're lucky I didn't read to the end of your message:  that's a pretty 
old version.  Please test on current versions before reporting problems.

Duncan Murdoch



More information about the R-help mailing list