From a745d2da3dc990fb6ea7dbda0c40e355a2cdbd6e Mon Sep 17 00:00:00 2001 From: stemangiola Date: Mon, 6 Jul 2020 21:28:55 +1000 Subject: [PATCH] fix CRAN requirements --- DESCRIPTION | 2 +- R/functions.R | 13 +++++++++---- R/methods.R | 12 ++++++++---- man/gate-methods.Rd | 12 ++++++++---- tests/testthat/test-methods.R | 22 +++++++++++----------- 5 files changed, 37 insertions(+), 24 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index fa071a0..57dd4eb 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: tidygate Type: Package Title: Add Gate Information to Your Tibble -Version: 0.2.5 +Version: 0.2.7 Authors@R: c(person(given = "Stefano", family = "Mangiola", diff --git a/R/functions.R b/R/functions.R index a006190..352b7f4 100755 --- a/R/functions.R +++ b/R/functions.R @@ -349,12 +349,19 @@ gate_interactive <- quo_is_symbol(.color) | quo_is_symbol(.shape) | quo_is_symbol(.size) & (.data %>% select(!!.size) %>% sapply(class) %in% c("numeric", "integer", "double")) - ) + ){ + # Reset par on exit + opar <- par(no.readonly =TRUE) + on.exit(par(opar)) + + # Set the new par par( mar=c(5.1, 4.1, 4.1, 8.1), xpd=TRUE, tck = -.01 # Reduce tick length ) + } + # Plot my_df %>% pretty_plot( @@ -367,9 +374,7 @@ gate_interactive <- # Loop over gates # Variable needed for recalling the attributes lates gate_list = map(1:how_many_gates, ~ my_matrix %>% gatepoints::fhs(mark = TRUE, ...)) - # Reset par on exit - opar <- par(no.readonly =TRUE) - on.exit(par(opar)) + # Return gate_list %>% diff --git a/R/methods.R b/R/methods.R index 176e31a..96b3388 100755 --- a/R/methods.R +++ b/R/methods.R @@ -30,11 +30,15 @@ #' #' @examples #' -#' \dontrun{ +#' \donttest{ +#' +#' if(interactive()){ +#' +#' tidygate::tidygate_data %>% +#' gate( .element = c(`ct 1`, `ct 2`), Dim1, Dim2 ) +#' +#' } #' -#' tidygate::tidygate_data %>% -#' gate( .element = c(`ct 1`, `ct 2`), Dim1, Dim2 ) -#' #' } #' #' library(magrittr) diff --git a/man/gate-methods.Rd b/man/gate-methods.Rd index 87e07f5..02dcf8a 100755 --- a/man/gate-methods.Rd +++ b/man/gate-methods.Rd @@ -94,11 +94,15 @@ This function allow the user to label data points in inside one or more 2D gates } \examples{ -\dontrun{ +\donttest{ + + if(interactive()){ + + tidygate::tidygate_data \%>\% + gate( .element = c(`ct 1`, `ct 2`), Dim1, Dim2 ) + + } -tidygate::tidygate_data \%>\% - gate( .element = c(`ct 1`, `ct 2`), Dim1, Dim2 ) - } library(magrittr) diff --git a/tests/testthat/test-methods.R b/tests/testthat/test-methods.R index 9252959..bd873c8 100755 --- a/tests/testthat/test-methods.R +++ b/tests/testthat/test-methods.R @@ -2,17 +2,17 @@ # # test_that("gate dimensions", { # library(dplyr) -# res = -# tidygate::tidygate_data %>% -# mutate(sh = factor(hierarchy)) %>% -# gate( -# .element = c(`ct 1`, `ct 2`), -# Dim1, Dim2, -# .color = hierarchy, -# .shape = sh, -# .size = hierarchy, -# how_many_gates = 2 -# ) + # res = + # tidygate::tidygate_data %>% + # mutate(sh = factor(hierarchy)) %>% + # gate( + # .element = c(`ct 1`, `ct 2`), + # Dim1, Dim2, + # .color = hierarchy, + # .shape = sh, + # .size = hierarchy, + # how_many_gates = 2 + # ) # # res2 = # tidygate::tidygate_data %>%