Learn R Programming

teal.widgets (version 0.5.1)

clean_brushedPoints: Clean brushed points

Description

Cleans and organizes output to account for NAs and remove empty rows. Wrapper around shiny::brushedPoints.

Usage

clean_brushedPoints(data, brush)

Value

A data.frame of selected rows.

Arguments

data

(data.frame)
A data.frame from which to select rows.

brush

(list)
The data from a brush e.g. input$plot_brush.

Examples

Run this code

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))

Run the code above in your browser using DataLab