I need to convert a numeric vector to a string, for example,
c(1,0,3,4,5)
into
"10345"
Any ideas?
You can do it with function paste()
and argument collapse=""
.
x<-c(1,0,3,4,5)
paste(x,collapse="")
[1] "10345"
do.call(paste0,as.list(x))
这个方法的好处是它可以与任何其他函数一起使用,而不仅仅是paste()。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.