How do we divide integers into vectors in r that make up numbers

I think an example should make things clear

I have

I would like some_ 1 to the following a_ Function of 2

Solution

Convert to characters and then split

a <- 6547
as.numeric(strsplit(as.character(a),"")[[1]])
## [1] 6 5 4 7
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>