Fix R CMD check lazy-load failure from duplicate R6 method registration#30
Fix R CMD check lazy-load failure from duplicate R6 method registration#30Copilot wants to merge 6 commits into
Conversation
…architecture Agent-Logs-Url: https://github.com/ethzplus/evoland-plus/sessions/39b6065d-0375-4ce9-ae25-40e65e2e68dd Co-authored-by: mmyrte <24587121+mmyrte@users.noreply.github.com>
…lock Agent-Logs-Url: https://github.com/ethzplus/evoland-plus/sessions/39b6065d-0375-4ce9-ae25-40e65e2e68dd Co-authored-by: mmyrte <24587121+mmyrte@users.noreply.github.com>
There was a problem hiding this comment.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
air
[air] reported by reviewdog 🐶
evoland-plus/inst/tinytest/test_alloc_params_t.R
Lines 79 to 80 in 2cfdcba
[air] reported by reviewdog 🐶
[air] reported by reviewdog 🐶
evoland-plus/inst/tinytest/test_trans_pot_t.R
Lines 11 to 12 in 2cfdcba
[air] reported by reviewdog 🐶
evoland-plus/inst/tinytest/test_trans_pot_t.R
Lines 37 to 38 in 2cfdcba
[air] reported by reviewdog 🐶
[air] reported by reviewdog 🐶
evoland-plus/inst/tinytest/test_trans_pot_t.R
Lines 43 to 44 in 2cfdcba
[air] reported by reviewdog 🐶
evoland-plus/inst/tinytest/test_trans_pot_t.R
Lines 48 to 49 in 2cfdcba
[air] reported by reviewdog 🐶
evoland-plus/inst/tinytest/test_trans_pot_t.R
Lines 81 to 82 in 2cfdcba
| #' @return Integer >= 1L, sampled patch area in cells. | ||
| #' @keywords internal | ||
| sample_lognorm_area <- function(area_mean, area_var) { | ||
| if (is.na(area_mean) || area_mean <= 0) return(1L) |
There was a problem hiding this comment.
[air] reported by reviewdog 🐶
| if (is.na(area_mean) || area_mean <= 0) return(1L) | |
| if (is.na(area_mean) || area_mean <= 0) { | |
| return(1L) | |
| } |
| above = ifelse(rows > 1L, seq_len(n) - ncol_r, 0L), | ||
| below = ifelse(rows < nrow_r, seq_len(n) + ncol_r, 0L), | ||
| left = ifelse(cols > 1L, seq_len(n) - 1L, 0L), | ||
| right = ifelse(cols < ncol_r, seq_len(n) + 1L, 0L) |
There was a problem hiding this comment.
[air] reported by reviewdog 🐶
| above = ifelse(rows > 1L, seq_len(n) - ncol_r, 0L), | |
| below = ifelse(rows < nrow_r, seq_len(n) + ncol_r, 0L), | |
| left = ifelse(cols > 1L, seq_len(n) - 1L, 0L), | |
| right = ifelse(cols < ncol_r, seq_len(n) + 1L, 0L) | |
| above = ifelse(rows > 1L, seq_len(n) - ncol_r, 0L), | |
| below = ifelse(rows < nrow_r, seq_len(n) + ncol_r, 0L), | |
| left = ifelse(cols > 1L, seq_len(n) - 1L, 0L), | |
| right = ifelse(cols < ncol_r, seq_len(n) + 1L, 0L) |
| n_cells <- nrow_r * ncol_r | ||
|
|
||
| ant_vec <- as.integer(terra::values(anterior_rast)) | ||
| post_vec <- ant_vec # will be modified in-place |
There was a problem hiding this comment.
[air] reported by reviewdog 🐶
| post_vec <- ant_vec # will be modified in-place | |
| post_vec <- ant_vec # will be modified in-place |
|
|
||
| # Cells currently in from_class (1-based raster index) | ||
| from_cells <- which(!is.na(ant_vec) & ant_vec == from_class) | ||
| if (length(from_cells) == 0L) next |
There was a problem hiding this comment.
[air] reported by reviewdog 🐶
| if (length(from_cells) == 0L) next | |
| if (length(from_cells) == 0L) { | |
| next | |
| } |
| for (j in seq_along(to_classes)) { | ||
| id_trans_j <- trans_for_class$id_trans[j] | ||
| pots_j <- adj_pots[id_trans == id_trans_j, .(id_coord, value)] | ||
| if (nrow(pots_j) == 0L) next |
There was a problem hiding this comment.
[air] reported by reviewdog 🐶
| if (nrow(pots_j) == 0L) next | |
| if (nrow(pots_j) == 0L) { | |
| next | |
| } |
| from_class = 1L, | ||
| to_class = 2L, | ||
| eccentricity = 0.5, | ||
| ncol = 4L |
There was a problem hiding this comment.
[air] reported by reviewdog 🐶
| ncol = 4L | |
| ncol = 4L |
| ncol = 4L | ||
| ) | ||
| expect_true(length(patch) <= 4L) | ||
| expect_true(1L %in% patch) # pivot always included |
There was a problem hiding this comment.
[air] reported by reviewdog 🐶
| expect_true(1L %in% patch) # pivot always included | |
| expect_true(1L %in% patch) # pivot always included |
| # Pivot with wrong class → empty result | ||
| landscape_wrong <- as.integer(rep(2L, n)) | ||
| patch_empty <- grow_patch_cpp( | ||
| landscape = landscape_wrong, |
There was a problem hiding this comment.
[air] reported by reviewdog 🐶
| landscape = landscape_wrong, | |
| landscape = landscape_wrong, |
| probs = probs, | ||
| nbr_above = nbrs$above, | ||
| nbr_below = nbrs$below, | ||
| nbr_left = nbrs$left, | ||
| nbr_right = nbrs$right, | ||
| pivot = 1L, | ||
| target_area = 4L, | ||
| from_class = 1L, | ||
| to_class = 2L, |
There was a problem hiding this comment.
[air] reported by reviewdog 🐶
| probs = probs, | |
| nbr_above = nbrs$above, | |
| nbr_below = nbrs$below, | |
| nbr_left = nbrs$left, | |
| nbr_right = nbrs$right, | |
| pivot = 1L, | |
| target_area = 4L, | |
| from_class = 1L, | |
| to_class = 2L, | |
| probs = probs, | |
| nbr_above = nbrs$above, | |
| nbr_below = nbrs$below, | |
| nbr_left = nbrs$left, | |
| nbr_right = nbrs$right, | |
| pivot = 1L, | |
| target_area = 4L, | |
| from_class = 1L, | |
| to_class = 2L, |
| from_class = 1L, | ||
| to_class = 2L, | ||
| eccentricity = 0.5, | ||
| ncol = 4L |
There was a problem hiding this comment.
[air] reported by reviewdog 🐶
| ncol = 4L | |
| ncol = 4L |
| params[c("mean_patch_size", "patch_size_variance", "patch_isometry", | ||
| "frac_expander", "frac_patcher")], |
There was a problem hiding this comment.
[air] reported by reviewdog 🐶
| params[c("mean_patch_size", "patch_size_variance", "patch_isometry", | |
| "frac_expander", "frac_patcher")], | |
| params[c( | |
| "mean_patch_size", | |
| "patch_size_variance", | |
| "patch_isometry", | |
| "frac_expander", | |
| "frac_patcher" | |
| )], |
|
|
||
| # as_trans_pot_t: basic construction | ||
| tp <- as_trans_pot_t(data.frame( | ||
| id_trans = 1L, |
There was a problem hiding this comment.
[air] reported by reviewdog 🐶
| id_trans = 1L, | |
| id_trans = 1L, |
| id_coord = 1L, | ||
| value = 0.3 |
There was a problem hiding this comment.
[air] reported by reviewdog 🐶
| id_coord = 1L, | |
| value = 0.3 | |
| id_coord = 1L, | |
| value = 0.3 |
| id_trans = c(1L, 2L, 1L, 2L, 1L, 2L), | ||
| id_coord = c(1L, 1L, 2L, 2L, 3L, 3L), |
There was a problem hiding this comment.
[air] reported by reviewdog 🐶
| id_trans = c(1L, 2L, 1L, 2L, 1L, 2L), | |
| id_coord = c(1L, 1L, 2L, 2L, 3L, 3L), | |
| id_trans = c(1L, 2L, 1L, 2L, 1L, 2L), | |
| id_coord = c(1L, 1L, 2L, 2L, 3L, 3L), |
| id_trans = c(1L, 2L, 1L, 2L, 1L, 2L), | ||
| id_coord = c(1L, 1L, 2L, 2L, 3L, 3L), | ||
| id_period_post = 4L, | ||
| value = c(0.6, 0.2, 0.1, 0.5, 0.3, 0.4) |
There was a problem hiding this comment.
[air] reported by reviewdog 🐶
| value = c(0.6, 0.2, 0.1, 0.5, 0.3, 0.4) | |
| value = c(0.6, 0.2, 0.1, 0.5, 0.3, 0.4) |
| id_trans = c(1L, 2L), | ||
| rate = c(0.2, 0.1) |
There was a problem hiding this comment.
[air] reported by reviewdog 🐶
| id_trans = c(1L, 2L), | |
| rate = c(0.2, 0.1) | |
| id_trans = c(1L, 2L), | |
| rate = c(0.2, 0.1) |
| mean_t1 <- mean(raw_vals$value[raw_vals$id_trans == 1L]) # (0.6+0.1+0.3)/3 | ||
| mean_t2 <- mean(raw_vals$value[raw_vals$id_trans == 2L]) # (0.2+0.5+0.4)/3 |
There was a problem hiding this comment.
[air] reported by reviewdog 🐶
| mean_t1 <- mean(raw_vals$value[raw_vals$id_trans == 1L]) # (0.6+0.1+0.3)/3 | |
| mean_t2 <- mean(raw_vals$value[raw_vals$id_trans == 2L]) # (0.2+0.5+0.4)/3 | |
| mean_t1 <- mean(raw_vals$value[raw_vals$id_trans == 1L]) # (0.6+0.1+0.3)/3 | |
| mean_t2 <- mean(raw_vals$value[raw_vals$id_trans == 2L]) # (0.2+0.5+0.4)/3 |
| expect_true(abs(col_mean_t1_scaled - rates$rate[1L]) <= | ||
| abs(mean_t1 - rates$rate[1L]) + 1e-9) |
There was a problem hiding this comment.
[air] reported by reviewdog 🐶
| expect_true(abs(col_mean_t1_scaled - rates$rate[1L]) <= | |
| abs(mean_t1 - rates$rate[1L]) + 1e-9) | |
| expect_true(abs(col_mean_t1_scaled - rates$rate[1L]) <= abs(mean_t1 - rates$rate[1L]) + 1e-9) |
R CMD check (light) failed during package load because
evoland_db_views.Rattempted to add public methods that are now already declared inevoland_db.R. The failure was caused by duplicate R6 method registration at load time.R6 method override compatibility
evoland_db$set(...)calls inR/evoland_db_views.Rto explicitly allow replacing predeclared methods:trans_rates_dinamica_vadjusted_trans_pot_valloc_params_clumpy_vevoland_db.Ras the canonical method declaration surface while preserving view-backed implementations inevoland_db_views.R.Behavioral impact