If you have several related data frames, the best of them all is on the list, and not all of them in the global environment. Based on your application
They are called propens1, propens2, propens3 and propens4
we can collect all your data frames using
datalist <- mget(ls(pattern = "propens[1-4]"))
Then, since you need four frames of data as a result, all we need to do is run merge() for each of them. Now that we have the data frames in the list, we can easily do this with lapply() .
lapply(datalist, merge, y = bmi, by = "cfact", all.x = TRUE)
source share