Skip to content

Commit

Permalink
Merge pull request #29 from william-hutchison/upgrade-gating
Browse files Browse the repository at this point in the history
Update gating examples
  • Loading branch information
stemangiola authored Jul 11, 2024
2 parents 75bb1a0 + 5bca7a9 commit 2319f9f
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 363 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: tidygate
Type: Package
Title: Interactively Gate Points
Version: 1.0.12
Version: 1.0.13
Authors@R:
c(person(given = "Stefano",
family = "Mangiola",
Expand Down
3 changes: 0 additions & 3 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@ S3method(gate_chr,numeric)
S3method(gate_int,numeric)
export(fhs)
export(gate)
export(gate.spec_tbl_df)
export(gate.tbl_df)
export(gate_chr)
export(gate_int)
export(gate_old)
export(server)
export(ui)
import(dplyr)
Expand Down
10 changes: 5 additions & 5 deletions R/fhs.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
##' @importFrom lifecycle deprecate_warn
##' @export
##' @examples
##' \dontrun{
##' x <- cbind(1:10, 1:10)
##' rownames(x) <- 1:10
##' plot(x, pch = 16, col = "red")
##' fhs(x)
##' if(interactive()) {
##' x <- cbind(1:10, 1:10)
##' rownames(x) <- 1:10
##' plot(x, pch = 16, col = "red")
##' fhs(x)
##' }
##' @importFrom graphics locator lines points
fhs <- function(data, mark = TRUE, names = TRUE, ...) {
Expand Down
3 changes: 2 additions & 1 deletion R/gate_app.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,11 @@ ui <- shiny::fluidPage(
#' @export
server <- function(input, output, session) {

# Fix CRAN note
# Fix CRAN notes
key <- NULL
curveNumber <- NULL
pointNumber <- NULL
.gate <- NULL

select_data <- tibble()
brush_data <- tibble()
Expand Down
32 changes: 13 additions & 19 deletions R/methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ utils::globalVariables(c(".key", ".rs.invokeShinyPaneViewer"))
#' @importFrom rlang quo_is_null
#' @importFrom magrittr "%>%"
#' @importFrom lifecycle deprecate_warn
#'
#'
#' @name gate_chr
#'
#'
Expand All @@ -30,19 +30,15 @@ utils::globalVariables(c(".key", ".rs.invokeShinyPaneViewer"))
#'
#' @return An character vector, with "0" for elements outside gates and "1..N" for the elements inside the N gates.
#'
#'
#' @examples
#'
#' \dontrun{
#' # Standard use - interactive
#'
#' if(interactive()){
#'
#' tidygate::tidygate_data %>%
#' distinct(`ct 1` , `ct 2`, Dim1, Dim2) %>%
#' mutate(gate = gate_chr( Dim1, Dim2))
#' if(interactive()){
#'
#' }
#' tidygate::tidygate_data %>%
#' distinct(`ct 1` , `ct 2`, Dim1, Dim2) %>%
#' mutate(gate = gate_chr( Dim1, Dim2))
#'
#' }
#'
Expand Down Expand Up @@ -227,11 +223,6 @@ gate_int.numeric = function( .dim1,
#' point size, either a numeric or factor of 6 or less levels.
#' @return A vector of strings, of the gates each X and Y coordinate pair is within. If gates are
#' drawn interactively, they are temporarily saved to `tidygate_env$gates`
#' @examples
#' \dontrun{
#' mtcars |>
#' mutate(selected = gate_interactive(x = mpg, y = wt, shape = am))
#'}
gate_interactive <-
function(x, y, colour = NULL, shape = NULL, alpha = 1, size = 2) {

Expand Down Expand Up @@ -467,15 +458,18 @@ gate_programmatic <-
#' @return A vector of strings, of the gates each X and Y coordinate pair is within. If gates are
#' drawn interactively, they are temporarily saved to `tidygate_env$gates`.
#' @examples
#' \dontrun{
#' library(dplyr)
#' data("demo_gate_data", package = "tidygate")
#'
#' # Gate points interactively
#' mtcars |>
#' mutate(gated = gate(x = mpg, y = wt, shape = am))
#' if(interactive()) {
#' mtcars |>
#' mutate(gated = gate(x = mpg, y = wt, shape = am))
#' }
#'
#' # Gate points programmatically
#' mtcars |>
#' mutate(gated = gate(x = mpg, y = wt, programmatic_gates = tidygate_env$programmatic_gates))
#'}
#' mutate(gated = gate(x = mpg, y = wt, programmatic_gates = demo_gate_data))
#' @export
gate <-
function(x, y, colour = NULL, shape = NULL, alpha = 1, size = 2, programmatic_gates = NULL) {
Expand Down
188 changes: 0 additions & 188 deletions R/methods_OLD.R

This file was deleted.

10 changes: 5 additions & 5 deletions man/fhs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2319f9f

Please sign in to comment.