[R] extract the digits of a number

Gustavo Carvalho gustavo.bio+R at gmail.com
Tue Dec 9 18:48:33 CET 2008


Hello,

Anyone knows how can I do this in a cleaner way?

mynumber = 1001
as.numeric(unlist(strsplit(as.character(mynumber),"")))
[1] 1 0 0 1

Thanks in advance,

Gustavo



More information about the R-help mailing list