Skip to content

Commit

Permalink
clean_brushedPoints
Browse files Browse the repository at this point in the history
  • Loading branch information
m7pr committed Mar 5, 2024
1 parent c66a5b4 commit cec59bb
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 10 deletions.
34 changes: 29 additions & 5 deletions R/plot_with_settings.R
Original file line number Diff line number Diff line change
Expand Up @@ -596,15 +596,39 @@ type_download_srv <- function(id, plot_reactive, plot_type, plot_w, default_w, p
)
}

#' Cleans and organizes output to account for NAs and remove empty rows.
#' Clean brushed points
#'
#' @description `r lifecycle::badge("stable")`
#' @description `r lifecycle::badge("stable")`\cr
#' Cleans and organizes output to account for NAs and remove empty rows. Wrapper around `shiny::brushedPoints`.
#' @param data (`data.frame`)\cr
#' A dataframe from which to select rows.
#' A data.frame from which to select rows.
#' @param brush (`list`)\cr
#' The data from a brush e.g. input$plot_brush.
#' The data from a brush e.g. `input$plot_brush`.
#'
#' @return A `data.frame` of selected rows.
#'
#' @examples
#'
#' brush <- list(
#' mapping = list(
#' x = "AGE",
#' y = "BMRKR1"
#' ),
#' xmin = 30, xmax = 40,
#' ymin = 0.7, ymax = 10,
#' direction = "xy"
#' )
#'
#' data <- data.frame(
#' STUDYID = letters[1:20],
#' USUBJID = LETTERS[1:20],
#' AGE = sample(25:40, size = 20, replace = TRUE),
#' BMRKR1 = runif(20, min = 0, max = 12)
#' )
#' nrow(clean_brushedPoints(data, brush))
#' data$AGE[1:10] <- NA
#' nrow(clean_brushedPoints(data, brush))
#'
#' @return A dataframe of selected rows.
#' @export
#'
clean_brushedPoints <- function(data, brush) { # nolint object_name_linter.
Expand Down
34 changes: 29 additions & 5 deletions man/clean_brushedPoints.Rd

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

0 comments on commit cec59bb

Please sign in to comment.