knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" ) library(tidyverse) df_gate <- readRDS("df_gate.rds") df_new <- readRDS("df_new.rds") iris
ggGate is a one-function-package enabling point-and-click gating on a ggplot2 object through shiny
You can install the development version of ggGate from GitHub with:
# install.packages("devtools") devtools::install_github("northNomad/ggGate")
suppressMessages(library(ggGate))
#create ggplot2 object p <- ggplot(iris, aes(Sepal.Length, Sepal.Width)) + geom_point() ggGate(p, write_data_to = "df_new", write_gate_to = "df_gate")
Name the current gate using the Name of gate text box
Single-click on plot to create and draw gate
Double-click on plot to finish gate
Click on action buttons to save gate coordinates and annotated data
knitr::include_graphics("plots/ggGate_example.png")
New columns corresponding to each gate are added to the data.frame underlying the ggplot2 object.
The new columns store boolean values indicating if the data points (rows) fall inside the respective gates.
colnames(iris) colnames(df_new)
dplyr::select(df_new, starts_with("Group")) %>% colSums()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.