Skip to content

Commit

Permalink
use rep.int & rep_len
Browse files Browse the repository at this point in the history
  • Loading branch information
qddyy committed Sep 11, 2023
1 parent 59edc7d commit 958d473
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions R/ContingencyTableTest.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ ContingencyTableTest <- R6Class(

private$.data_permu <- lapply(
X = permutations(
v = rep(seq_len(r), row_sum),
v = rep.int(seq_len(r), row_sum),
nsample = private$.n_permu, layout = "list"
),
FUN = function(data, col_index) {
vapply(
X = split(data, col_index), USE.NAMES = FALSE,
FUN = tabulate, nbins = r, FUN.VALUE = integer(r)
)
}, col_index = rep(seq_len(c), col_sum)
}, col_index = rep.int(seq_len(c), col_sum)
)
},

Expand Down
2 changes: 1 addition & 1 deletion R/KolmogorovSmirnov.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ KolmogorovSmirnov <- R6Class(
m <- length(private$.data$x)
n <- length(private$.data$y)

tmp <- rep.int(1 / m, m + n)
tmp <- rep_len(1 / m, m + n)
private$.statistic_func <- function(x, y) {
max(abs(cumsum(`[<-`(tmp, order(c(x, y)) <= m, -1 / n))))
}
Expand Down
2 changes: 1 addition & 1 deletion R/TwoSamplePairedTest.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ TwoSamplePairedTest <- R6Class(
.calculate_statistic = function() {
if (private$.use_swapped) {
private$.statistic <- private$.statistic_func(
swapped = rep.int(FALSE, nrow(private$.data))
swapped = rep_len(FALSE, nrow(private$.data))
)
} else {
super$.calculate_statistic()
Expand Down

0 comments on commit 958d473

Please sign in to comment.