Skip to content

Commit

Permalink
improve tab2() algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
gvelasq committed Mar 21, 2018
1 parent 672712f commit 37df283
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/tab.R
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,11 @@ tab1 <- function(x, ..., m = TRUE) {
tab2 <- function(x, ..., m = TRUE) {
vars <- rlang::quos(...)
filter <- function(x, y) {
x >= y
x <= y
}
tab_sequence <- purrr::cross2(1L:length(vars), 1L:length(vars), .filter = filter)
for (i in 1L:length(tab_sequence)) {
tab(x = x, UQ(vars[[purrr::as_vector(tab_sequence[[i]])[1]]]), UQ(vars[[purrr::as_vector(tab_sequence[[i]])[2]]]), m = m)
tab(x = x, UQ(vars[[purrr::as_vector(tab_sequence[[i]])[2]]]), UQ(vars[[purrr::as_vector(tab_sequence[[i]])[1]]]), m = m)
cat("\n")
}
}

0 comments on commit 37df283

Please sign in to comment.