You can try
Reduce(function(...) merge(..., by='users', all=TRUE), lst)
# users V1.x V1.y
#1 28 3 NA
#2 33 1 2
#3 35 4 NA
#4 260 1 1
#5 285 NA 13
Another option would be to use join_all
from plyr
. But, this requires the column names other than the one used in the by=
to be named differently.
library(plyr)
nm1 <- make.names(sapply(lst, colnames)[-1,],unique=TRUE)
join_all(Map(function(x,y) {names(x)[-1] <- y; x}, lst, nm1),
by='users', type='full')
# users V1 V1.1
#1 28 3 NA
#2 33 1 2
#3 35 4 NA
#4 260 1 1
#5 285 NA 13
data
lst <- list(structure(list(users = c(28L, 33L, 35L, 260L), V1 = c(3L,
1L, 4L, 1L)), .Names = c("users", "V1"), class = "data.frame",
row.names = c("1", "2", "3", "4")), structure(list(users = c(33L, 260L, 285L),
V1 = c(2L, 1L, 13L)), .Names = c("users", "V1"), class = "data.frame",
row.names = c("1", "2", "3")))