I simply need to merge (like a plait?) to elements that contain numeric values. I know I can past()
, but I need to the number to stay as numeric.
x <- 1:2; x
# [1] 1 2
y <- c(9999, 9999); y
# [1] 9999 9999
z <- [some function]; z
# [1] 1 9999 2 9999 # my desired output
class(z)
[1] "numeric"
We can use Map
,
unlist(Map(c, x, y))
#[1] 1 9999 2 9999
str(unlist(Map(c, x, y)))
# num [1:4] 1 9999 2 9999
class(unlist(Map(c, x, y)))
#[1] "numeric"