Lifecycle:maturing

Please have a look also to

library(knitr)
knitr::opts_chunk$set(cache = TRUE, warning = FALSE,
                      message = FALSE, cache.lazy = FALSE)

library(dplyr)
library(tidygate)

Installation

# From Github
devtools::install_github("stemangiola/tidygate")

# From CRAN
install.package("tidygate")

What is tidygate

It interactively or programmately labels points within custom gates on two dimensions, according to tidyverse principles. The information is added to your tibble. It is based on the package gatepoints from Wajid Jawaid.

The main benefits are

Input

A tibble of this kind

dimension1 | dimension2 | annotations | ------------- | ------------- | ------------- chr or fctr | numeric | ...

Step-by-step instructons for Rstudio

1) Execute the following code in the console panel
tidygate_gate <-
  tidygate_data %>%
  mutate( gate = gate_chr( Dim1, Dim2 ) )
2) look at the Viewer and draw a gate clicking at least three times on the plot

3) Click the finish button on the top-right corner, or press escape on your keyboard

The output tibble

tidygate_gate
tidygate_data %>%
  mutate( gate = gate_chr(
    Dim1, Dim2,
     # Pre-defined gates
    gate_list = tidygate::gate_list
  ))

Gates are saved in a temporary file for later use

my_gates = tidygate::gate_list

my_gates

Programmatic gating

We can use previously drawn gates to programmately add the gate column

tidygate_data %>%
  mutate( gate = gate_chr(
    Dim1, Dim2,
     # Pre-defined gates
    gate_list = my_gates
  ))


stemangiola/tidygate documentation built on Nov. 19, 2023, 7:31 a.m.