Say I have two lists:
a = list(1,2)
b = list("x","y")
#a
#[[1]]
#[1] 1
#[[2]]
#[1] 2
#b
#[[1]]
#[1] "x"
#[[2]]
#[1] "y"
I would like the following result:
#[[1]]
#[1] "1x"
#[[2]]
#[1] "2y"
I tried the following:
lapply(a, paste, b)
But the result was not what I expected:
#[[1]]
#[1] "1 x" "1 y"
#[[2]]
#[1] "2 x" "2 y"
I wonder if there is any way to get the desired result – without resorting to any added package or loop.
Thank you in advance!!!
Here is one suggestion: