Lets say I have a vector x which is
x = c(1,2,3,4,5)
and I want it to have a single length of all the numbers in the vector so that the end result looks like this:
x = 12345
If I then want to example multiply it by 2 it would show: 12345*2 = 24690
Instead of: 1,2,3,4,5 * 2 = 2,4,6,8,10
Any easy way to do it?
Another option with Reduce()
as.numeric(Reduce(paste0, x))
# [1] 12345
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With