diff --git a/R/get_sig_MSE.R b/R/get_sig_MSE.R index 9cc7417..b9a3e7a 100644 --- a/R/get_sig_MSE.R +++ b/R/get_sig_MSE.R @@ -14,6 +14,18 @@ #' @export get_sig_MSE <- function(x3p, method = "median", ifplot = FALSE, delta = -5:5) { + y <- + value_nobs <- + x <- + value <- + x_shift_delta_value <- + x_shift_delta <- + Dat <- + value_approx <- + mask <- + value_summary <- + NULL + x3p_df <- x3p %>% x3p_to_df() diff --git a/R/get_sig_raw.R b/R/get_sig_raw.R index 718c1bf..4f934d1 100644 --- a/R/get_sig_raw.R +++ b/R/get_sig_raw.R @@ -11,6 +11,11 @@ #' @export get_sig_raw <- function(x3p, method = "median", ifplot = FALSE) { + x <- + value <- + value_summary <- + NULL + x3p_df <- x3p %>% x3p_to_df() diff --git a/R/get_sigalign.R b/R/get_sigalign.R index c4c0c64..f25cb18 100644 --- a/R/get_sigalign.R +++ b/R/get_sigalign.R @@ -22,6 +22,8 @@ get_sigalign <- function( name2 = "Cut2", legendname = "Signal", titlename = NULL) { + x <- NULL + sigalign <- sig_align(sig1, sig2) if (ifplot) { p <- sigalign$lands %>% diff --git a/R/get_x3p_inner_df.R b/R/get_x3p_inner_df.R index 82dba08..c0d4b9d 100644 --- a/R/get_x3p_inner_df.R +++ b/R/get_x3p_inner_df.R @@ -10,9 +10,18 @@ #' @importFrom stats sd #' @importFrom raster raster adjacent ncell #' @importFrom wires x3p_surface_polygon +#' @importFrom rlang .data #' @export get_x3p_inner_df <- function(x3p, mask_col = "#FF0000", concavity = 1.5) { + to <- + from <- + neighbor_val <- + x <- + y <- + n_neighbor_val_miss <- + NULL + x3p <- x3p %>% x3p_surface_polygon(colour = mask_col, concavity = concavity) @@ -82,7 +91,7 @@ get_x3p_inner_df <- function(x3p, mask_col = "#FF0000", concavity = 1.5) { ) ) %>% full_join( - ., + .data, x3p_inner_df_wide_sd_not_miss %>% pivot_longer( cols = everything(), diff --git a/R/get_x3p_inner_impute.R b/R/get_x3p_inner_impute.R index 4f0c430..1ac729a 100644 --- a/R/get_x3p_inner_impute.R +++ b/R/get_x3p_inner_impute.R @@ -16,10 +16,17 @@ #' @importFrom magick image_read image_join image_animate image_write #' @importFrom stringr str_detect #' @importFrom wires x3p_surface_polygon +#' @importFrom rlang .data #' @export get_x3p_inner_impute <- function(x3p, mask_col = "#FF0000", concavity = 1.5, ifsave = FALSE, dir_name = NULL, ifplot = FALSE) { + layer <- + x <- + y <- + value <- + NULL + if (ifsave) { assert_that(not_empty(dir_name), msg = "dir_name must be non-empty") assert_that(is.character(dir_name), msg = "dir_name must be character") @@ -133,7 +140,7 @@ get_x3p_inner_impute <- function(x3p, mask_col = "#FF0000", concavity = 1.5, path = dir_name, full.names = TRUE ) %>% - .[str_detect(., pattern = ".png")] %>% + .data[str_detect(.data, pattern = ".png")] %>% file.remove() %>% invisible() } diff --git a/R/get_x3p_inner_nomiss_res.R b/R/get_x3p_inner_nomiss_res.R index 2ec1ae5..a6e735a 100644 --- a/R/get_x3p_inner_nomiss_res.R +++ b/R/get_x3p_inner_nomiss_res.R @@ -7,9 +7,16 @@ #' @import dplyr #' @importFrom x3ptools df_to_x3p #' @importFrom stats lm predict +#' @importFrom rlang .data #' @export get_x3p_inner_nomiss_res <- function(x3p, mask_col = "#FF0000", concavity = 1.5) { + n_neighbor_val_miss <- + value <- + x <- + y <- + NULL + x3p_inner_df <- get_x3p_inner_df(x3p, mask_col = mask_col, concavity = concavity) x3p_inner_nomiss_df <- x3p_inner_df %>% @@ -18,11 +25,11 @@ get_x3p_inner_nomiss_res <- function(x3p, mask_col = "#FF0000", concavity = 1.5) ### Remove trend x3p_inner_nomiss_lm <- lm(value ~ x + y + I(x^2) + I(y^2) + x:y, data = x3p_inner_nomiss_df) x3p_inner_nomiss_res_df <- x3p_inner_nomiss_df %>% - mutate(value = value - predict(x3p_inner_nomiss_lm, select(., x, y))) + mutate(value = value - predict(x3p_inner_nomiss_lm, select(.data, x, y))) ### Convert df to x3p x3p_inner_nomiss_res <- x3p_inner_nomiss_res_df %>% - left_join(x3p_inner_df[, c("x", "y")], .) %>% + left_join(x3p_inner_df[, c("x", "y")], .data) %>% df_to_x3p() return(x3p_inner_nomiss_res) diff --git a/R/get_x3p_rotate_angle_MLE.R b/R/get_x3p_rotate_angle_MLE.R index 7fe70c0..1091ca6 100644 --- a/R/get_x3p_rotate_angle_MLE.R +++ b/R/get_x3p_rotate_angle_MLE.R @@ -11,17 +11,25 @@ #' @importFrom raster raster #' @importFrom imager as.cimg hough_line nfline #' @importFrom stats loess predict +#' @importFrom rlang .data #' @export get_x3p_rotate_angle_MLE <- function(x3p, ntheta = 720, min_score_cut = 2, ifplot = FALSE, loess_span = 0.2) { + theta <- + score <- + theta_mod <- + theta_mod_shift <- + rho <- + NULL + ### Change to contrast color x3p_shift <- x3p$surface.matrix NA_val <- -(x3p$surface.matrix %>% c() %>% summary() %>% - .[c("Min.", "Max.")] %>% + .data[c("Min.", "Max.")] %>% abs() %>% max() %>% ceiling()) diff --git a/R/get_x3p_rotate_angle_quantile.R b/R/get_x3p_rotate_angle_quantile.R index 57fac8e..6914357 100644 --- a/R/get_x3p_rotate_angle_quantile.R +++ b/R/get_x3p_rotate_angle_quantile.R @@ -10,17 +10,25 @@ #' @importFrom raster raster #' @importFrom imager as.cimg hough_line nfline #' @importFrom stats quantile median +#' @importFrom rlang .data #' @export get_x3p_rotate_angle_quantile <- function(x3p, ntheta = 720, min_score_cut = 2, ifplot = FALSE) { + theta <- + theta_mod <- + theta_mod_shift <- + score <- + rho <- + NULL + ### Change to contrast color x3p_shift <- x3p$surface.matrix x3p_shift[is.na(x3p$surface.matrix)] <- -(x3p$surface.matrix %>% c() %>% summary() %>% - .[c("Min.", "Max.")] %>% + .data[c("Min.", "Max.")] %>% abs() %>% max() %>% ceiling()) @@ -63,7 +71,7 @@ get_x3p_rotate_angle_quantile <- function(x3p, ntheta = 720, min_score_cut = 2, ### How to set a score cutoff line without hardcoding the quantile? theta_mod_shift_med <- x3p_hough_df_shift %>% - filter(score >= quantile(.$score, 0.99995, na.rm = TRUE)) %>% + filter(score >= quantile(.data$score, 0.99995, na.rm = TRUE)) %>% summarise(med = median(theta_mod_shift)) %>% unlist()