From 4e7e7fb87a9b60f8fb4c3c44973ce581ca67bde8 Mon Sep 17 00:00:00 2001 From: "Yuhang (Tom) Lin" Date: Mon, 18 Mar 2024 23:02:47 -0500 Subject: [PATCH] Extra pause and dir_name check --- NAMESPACE | 1 + R/x3p_impute.R | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/NAMESPACE b/NAMESPACE index e3c9790..f32098f 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -66,6 +66,7 @@ importFrom(stats,quantile) importFrom(stats,sd) importFrom(stats,t.test) importFrom(stringr,str_detect) +importFrom(stringr,str_remove) importFrom(tidyr,nest) importFrom(tidyr,pivot_longer) importFrom(tidyr,unnest) diff --git a/R/x3p_impute.R b/R/x3p_impute.R index 2d6df7f..2da8bbe 100644 --- a/R/x3p_impute.R +++ b/R/x3p_impute.R @@ -17,6 +17,7 @@ #' @importFrom magick image_read image_join image_animate image_write #' @importFrom stringr str_detect #' @importFrom assertthat assert_that is.flag not_empty is.string +#' @importFrom stringr str_remove #' @export #' @examples #' x3p <- x3p_subsamples[[1]] @@ -57,6 +58,7 @@ x3p_impute <- function(x3p, ifout = FALSE, ifsave = FALSE, dir_name = NULL, gif_ assert_that( is.string(dir_name) ) + dir_name <- str_remove(dir_name, "/$") } else { # dir_name <- tempdir(check = TRUE) tmpfile <- tempfile(fileext = "txt") @@ -250,7 +252,7 @@ x3p_impute <- function(x3p, ifout = FALSE, ifsave = FALSE, dir_name = NULL, gif_ if (ifsave) { ### List file names and read in - x3p_inner_nomiss_res_focal_impute_gif <- paste0(dir_name, "/gif_p", 0:nimp, ".png") %>% + x3p_inner_nomiss_res_focal_impute_gif <- paste0(dir_name, "/gif_p", c(rep(0, 4), 0:nimp, rep(nimp, 9)), ".png") %>% map(image_read) %>% ### Join the images together image_join() %>%