I'd suggest you try the tidyverse approach that @jasvinderahuja suggested. You could select only the required columns from the bc & mr dataframes.
To get close to the same output as you were attempting, you could something like this:
library(tidyverse)
r<-c("c6_gen_minc", "c_num_hh", "caseid")
bc <- read_dta("bc_r2.dta") %>%
select(r) %>%
setNames(paste0('bc_', names(.))
mr<- read_dta("master_r1.dta") %>%
select(r) %>%
setNames(paste0('mr_', names(.))
meg<-full_join(bc, mr, by = c('bc_caseid' = 'mr_caseid')) %>%
setNames(paste0('meg_', names(.))) %>%
rename(caseid = meg_bc_caseid)
It'd be much nicer without all the renaming & if the output were 'tidy' which could be done a bit like this (not checked this, so please excuse any stupid errors):
library(tidyverse)
r<-c("c6_gen_minc", "c_num_hh", "caseid")
mr<- read_dta("master_r1.dta") %>%
select(r) %>%
mutate(src = 'mr')
bc <- read_dta("bc_r2.dta") %>%
select(r) %>%
mutate(src = 'bc') %>%
filter(caseid %in% mr$caseid)
meg<-bind_rows(bc, filter(mr, caseid %in% bc$caseid))
you could then use tidyr::pivot_wider if you needed the wider form.
Hope that helps & I didn't make too many stupid mistakes!