Reputation: 525
I need to convert a numeric vector to a string, for example,
c(1,0,3,4,5)
into
"10345"
Any ideas?
Upvotes: 3
Views: 4183
Reputation: 8818
do.call(paste0,as.list(x))
The good thing about this method is that it would work with any other function, not only paste().
Upvotes: 1
Reputation: 98419
You can do it with function paste()
and argument collapse=""
.
x<-c(1,0,3,4,5)
paste(x,collapse="")
[1] "10345"
Upvotes: 8