Q:

Convert a vector of integers into a single number

Does anyone know a way to turn a vector of integers into a single number in R, for example:
> x <- c(1,2,3)
> x <- compress(x)
> x
[1] 123

Where compress() would be some sort of function to do so.
I would like the value x to be a single number so I can multiply it by an encryption key.

A:

Try this
x = 1:3
as.numeric(paste(x, collapse = ""))
# 123

