R/get_newlevel_tibble.R

Defines functions get_newlevel_tibble

#' @importFrom dplyr anti_join
#' @importFrom dplyr bind_rows
#' @importFrom dplyr mutate
#' @importFrom dplyr select
get_newlevel_tibble <- function(Mlist1, Mlist2){
  out_vec <- vector("list", length = length(Mlist1))
  if(length(Mlist2) > 0){
    for(i in 1:length(out_vec)){
      out_vec[[i]] <- anti_join(Mlist1[[i]], Mlist2[[i]], by = "value") %>% 
        mutate(origin_df = "df1") %>%
        bind_rows(
          anti_join(Mlist2[[i]], Mlist1[[i]], by = "value") %>% 
            mutate(origin_df = "df2")) %>%
        select(-prop) 
    }
  }
  return(out_vec)
}

Try the inspectdf package in your browser

Any scripts or data that you put into this service are public.

inspectdf documentation built on Aug. 9, 2022, 9:05 a.m.