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

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -