From 76bfc6d44a8eba47bd8c17d4b06fb48e474515dc Mon Sep 17 00:00:00 2001 From: Kyle Chesney Date: Wed, 31 Aug 2022 12:39:28 -0400 Subject: [PATCH] escape . to treat as literal character instead of wildcard in gsub statements --- R/dataset_diff.R | 2 +- R/write_data.R | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/dataset_diff.R b/R/dataset_diff.R index e8e2835..98675f4 100644 --- a/R/dataset_diff.R +++ b/R/dataset_diff.R @@ -48,7 +48,7 @@ dataset_diff <- function(source, dplyr::anti_join(target) %>% dplyr::inner_join(target, by=source_pk) %>% dplyr::select(dplyr::any_of(target_pk), dplyr::any_of(names(source)), dplyr::ends_with(".x")) %>% - dplyr::rename_with(., ~ gsub(".x", "", .x), dplyr::ends_with(".x")) + dplyr::rename_with(., ~ gsub("\\.x", "", .x), dplyr::ends_with(".x")) ids_of_update_records <- update_records %>% dplyr::pull({{target_pk}}) diff --git a/R/write_data.R b/R/write_data.R index 665c320..94dc82c 100644 --- a/R/write_data.R +++ b/R/write_data.R @@ -228,7 +228,7 @@ sync_table_2 <- function( dplyr::anti_join(target) %>% dplyr::inner_join(target, by=source_pk) %>% dplyr::select(dplyr::any_of(target_pk), dplyr::any_of(names(source)), dplyr::ends_with(".x")) %>% - dplyr::rename_with(., ~ gsub(".x", "", .x), dplyr::ends_with(".x")) + dplyr::rename_with(., ~ gsub("\\.x", "", .x), dplyr::ends_with(".x")) ids_of_update_records <- update_records %>% dplyr::pull({{target_pk}})