[R] problem with intToChar

Sarah Goslee sarah.goslee at gmail.com
Tue Jun 1 22:49:56 CEST 2010


That isn't really enough information to answer your question, since you
don't tell us where intToChar comes from or what you are trying to do,
but here are a couple of possibilities:

> ?intToChar
No documentation for 'intToChar' in specified packages and libraries:
you could try '??intToChar'
> testdata <- sample(1:6, 10, replace=TRUE)
> testdata
 [1] 5 3 2 5 6 3 4 5 4 4
> as.character(testdata)
 [1] "5" "3" "2" "5" "6" "3" "4" "5" "4" "4"
> letters[testdata]
 [1] "e" "c" "b" "e" "f" "c" "d" "e" "d" "d"

Sarah

On Tue, Jun 1, 2010 at 4:43 PM, Changbin Du <changbind at gmail.com> wrote:
> Hi, Dear R- community,
>
> I am use the intToChar function to convert the integers to letters. But the
> output is mess. Can you guys give some suggestions?   Thanks!
>
>> outcome.predict
>  [1]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  7  4  4  4  4  4  4
> 4  4
>  [26]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  7  4  4  4  4  4  7  4  4
> 4  4
>> outcome.label<-intToChar(outcome.predict)
>> outcome.label
>  [1] "\004" "\004" "\004" "\004" "\004" "\004" "\004" "\004" "\004" "\004"
>  [11] "\004" "\004" "\004" "\004" "\004" "\004" "\a"   "\004" "\004" "\004"
>  [21] "\004" "\004" "\004" "\004" "\004" "\004" "\004" "\004" "\004" "\004"
>  [31] "\004" "\004" "\004" "\004" "\004" "\004" "\004" "\004" "\004" "\a"
> --
> Sincerely,
> Changbin
> --


-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list