How to extract a number into digits using R? -


suppose have number: 4321

and want extract digits: 4, 3, 2, 1

how do this?

alternatively, strsplit:

x <- as.character(4321) as.numeric(unlist(strsplit(x, ""))) [1] 4 3 2 1 

Comments

Popular posts from this blog

c++ - Linked List error when inserting for the last time -

c++ - Issues with OpenGL referencing when compiling in Ubuntu terminal -

Using Angularjs $http in browser console -