I have two data frames that I would like to merge, with the values in each cell being pasted (with a space) together.
x <- letters[1:5]
x1 <- letters[7:11]
x.d <- data.frame(x,x1)
names(x.d) <- c("California","Nevada")
rownames(x.d) <- c("one","two","three","four","five")
x.d
California Nevada
one a g
two b h
three c i
four d j
five e k
y <- letters[2:5]
y1 <- letters[12:15]
y.d <- data.frame(y,y1)
y.d[2,2] <- NA
names(y.d) <- c("Nevada","Texas")
rownames(y.d) <- c("one","two","four","five")
y.d
Nevada Texas
one b l
two c <NA>
four d n
five e o
##Desired output "all"
a1 <- c("a","b","c","d","e")
a2 <- c("g b","h c","i","j d","k e")
a3 <- c("l","","","n","o")
all <- data.frame(a1,a2,a3)
names(all) <- c("California","Nevada","Texas")
rownames(all) <- c("one","two","three","four","five")
all
California Nevada Texas
one a g b l
two b h c
three c i
four d j d n
five e k e o
Where the result should look the variable "all". I was trying tidyverse and lapply functions, but I can't figure this out. Any ideas?