Skip to content

Commit

Permalink
Fix notes about no visible binding for global variable
Browse files Browse the repository at this point in the history
  • Loading branch information
YuhangTom committed Sep 24, 2023
1 parent 79c1ff5 commit 77b92e0
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 7 deletions.
12 changes: 12 additions & 0 deletions R/get_sig_MSE.R
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
5 changes: 5 additions & 0 deletions R/get_sig_raw.R
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 2 additions & 0 deletions R/get_sigalign.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>%
Expand Down
11 changes: 10 additions & 1 deletion R/get_x3p_inner_df.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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(),
Expand Down
9 changes: 8 additions & 1 deletion R/get_x3p_inner_impute.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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()
}
Expand Down
11 changes: 9 additions & 2 deletions R/get_x3p_inner_nomiss_res.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>%
Expand All @@ -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)
Expand Down
10 changes: 9 additions & 1 deletion R/get_x3p_rotate_angle_MLE.R
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
12 changes: 10 additions & 2 deletions R/get_x3p_rotate_angle_quantile.R
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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()

Expand Down

0 comments on commit 77b92e0

Please sign in to comment.