Skip to content

Commit 9113175

Browse files
committed
use rep.int & rep_len
1 parent 59edc7d commit 9113175

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

R/ANOVA.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ ANOVA <- R6Class(
4747
bar_.. <- mean(data)
4848
bar_i. <- c(
4949
lapply(
50-
splited, function(x) rep.int(mean(x), length(x))
50+
splited, function(x) rep_len(mean(x), length(x))
5151
), recursive = TRUE, use.names = FALSE
5252
)
5353

R/ContingencyTableTest.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ ContingencyTableTest <- R6Class(
3131

3232
private$.data_permu <- lapply(
3333
X = permutations(
34-
v = rep(seq_len(r), row_sum),
34+
v = rep.int(seq_len(r), row_sum),
3535
nsample = private$.n_permu, layout = "list"
3636
),
3737
FUN = function(data, col_index) {
3838
vapply(
3939
X = split(data, col_index), USE.NAMES = FALSE,
4040
FUN = tabulate, nbins = r, FUN.VALUE = integer(r)
4141
)
42-
}, col_index = rep(seq_len(c), col_sum)
42+
}, col_index = rep.int(seq_len(c), col_sum)
4343
)
4444
},
4545

R/KSampleTest.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ KSampleTest <- R6Class(
2525

2626
private$.raw_data <- setNames(
2727
c(data, recursive = TRUE, use.names = FALSE),
28-
rep(seq_along(data), times = vapply(data, length, integer(1)))
28+
rep.int(seq_along(data), vapply(data, length, integer(1)))
2929
)
3030
},
3131

R/KolmogorovSmirnov.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ KolmogorovSmirnov <- R6Class(
3030
m <- length(private$.data$x)
3131
n <- length(private$.data$y)
3232

33-
tmp <- rep.int(1 / m, m + n)
33+
tmp <- rep_len(1 / m, m + n)
3434
private$.statistic_func <- function(x, y) {
3535
max(abs(cumsum(`[<-`(tmp, order(c(x, y)) <= m, -1 / n))))
3636
}

R/TwoSamplePairedTest.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ TwoSamplePairedTest <- R6Class(
4949
.calculate_statistic = function() {
5050
if (private$.use_swapped) {
5151
private$.statistic <- private$.statistic_func(
52-
swapped = rep.int(FALSE, nrow(private$.data))
52+
swapped = rep_len(FALSE, nrow(private$.data))
5353
)
5454
} else {
5555
super$.calculate_statistic()

0 commit comments

Comments
 (0)