diff --git a/R/distance_helpers.R b/R/distance_helpers.R index 640d58b..09c6cc9 100644 --- a/R/distance_helpers.R +++ b/R/distance_helpers.R @@ -118,7 +118,7 @@ nearest_neighbor_summary_single_impl = function(csd, phenotypes, dplyr::ungroup() # Optionally save details with a subset of columns - if (!is.null(details_path)) { + if (!is.null(details_path) && length(details_path) > 0 && nrow(distances) > 0) { distances_subset = distances %>% dplyr::select(!!.by, `Cell ID`, `Cell X Position`, `Cell Y Position`, !!field_col, @@ -307,7 +307,7 @@ count_within_summary_impl = function(csd, phenotypes, radii, dplyr::ungroup() # Optionally save details with a subset of columns - if (!is.null(category_path) && nrow(counts) > 0) { + if (!is.null(category_path) && length(category_path) > 0 && nrow(counts) > 0) { counts_subset = counts %>% dplyr::select(!!.by, `Cell ID`, `Cell X Position`, `Cell Y Position`, !!field_col, diff --git a/inst/analysis_app/formatters.R b/inst/analysis_app/formatters.R index b3e35f8..0b6e3a3 100644 --- a/inst/analysis_app/formatters.R +++ b/inst/analysis_app/formatters.R @@ -306,7 +306,7 @@ format_cleanup = function(slide_id_prefix, use_regex, has) { # Now slide_id_prefix is a valid regex. We still have to double-escape \ # to put it into a string literal. - slide_id_prefix = stringr::str_replace(slide_id_prefix, + slide_id_prefix = stringr::str_replace_all(slide_id_prefix, stringr::fixed('\\'), '\\\\') # Note: Don't use mutate() in cleanup(),