May be you can try:
cAB <- union(colnames(A), colnames(B))
rAB <- union(rownames(A), rownames(B))
A1 <- matrix(0, ncol=length(cAB), nrow=length(rAB), dimnames=list(rAB, cAB))
B1 <- A1
indxA <- outer(rAB, cAB, FUN=paste) %in% outer(rownames(A), colnames(A), FUN=paste)
indxB <- outer(rAB, cAB, FUN=paste) %in% outer(rownames(B), colnames(B), FUN=paste)
A1[indxA] <- A
B1[indxB] <- B
A1+B1 #because it was mentioned to have `0` as missing values
# a b c d e
#v 1 1 1 0 1
#w 1 1 0 2 0
#x 1 0 1 1 0
#y 0 1 2 1 0
#z 1 0 0 0 0
If you want to get the NA
as missing values
A1 <- matrix(NA, ncol=length(cAB), nrow=length(rAB), dimnames=list(rAB, cAB))
B1 <- A1
A1[indxA] <- A
B1[indxB] <- B
indxNA <- is.na(A1) & is.na(B1)
A1[is.na(A1)!= indxNA] <- 0
B1[is.na(B1)!= indxNA] <- 0
A1+B1
# a b c d e
#v 1 1 1 0 1
#w 1 1 0 2 0
#x 1 0 1 1 NA
#y 0 1 2 1 0
#z 1 NA 0 0 0
Or using reshape2
library(reshape2)
acast(rbind(melt(A), melt(B)), Var1~Var2, sum) #Inspired from the OP's idea
# a b c d e
#v 1 1 1 0 1
#w 1 1 0 2 0
#x 1 0 1 1 0
#y 0 1 2 1 0
#z 1 0 0 0 0
data
A <- structure(c(1L, 1L, 1L, 0L, 1L, 1L, 0L, 1L, 1L, 0L, 1L, 1L, 0L,
1L, 1L, 1L), .Dim = c(4L, 4L), .Dimnames = list(c("v", "w", "x",
"y"), c("a", "b", "c", "d")))
B <- structure(c(0L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 1L,
0L, 0L, 0L), .Dim = c(4L, 4L), .Dimnames = list(c("v", "w", "y",
"z"), c("a", "c", "d", "e")))