replace_xy: Replace NA in .x cols by .y cols (or vice versa) after...

View source: R/misc.R

replace_xyR Documentation

Replace NA in .x cols by .y cols (or vice versa) after incomplete *_join

Description

Replace NA in .x cols by .y cols (or vice versa) after incomplete *_join

Usage

replace_xy(tbl, vars = NULL, ending_to_keep = ".x")

Arguments

tbl

A tibble or data_frame

vars

By default, the function searches for variables with .x/.y suffixes. Alternatively, a character vector of names of variables that are duplicated can be provided. This is useful when operating with sf objects because 'geometry' column will throw an error with the automated search. These variable must be entered without .x or .y suffixes.

ending_to_keep

Choose which column suffix should be kept for rows where both columns have values. Currently only implemented for .x/.y.

Value

A tibble with merged columns


AltfunsMA/cptools documentation built on Aug. 7, 2022, 5:44 p.m.