tidygate: high-level data analysis and manipulation in tidyverse style

Lifecycle:maturing

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

library(dplyr)
library(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 (tibble)

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

Command input %>% gate(element, dimension1, dimension2)

Output (tibble)

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

Interactive gating

The standard way to gate points in a two-dimensional plot is to - Interactively draw an arbitrary number of gates - Click "Finish" button on the top-right corner of the plot

tidygate_gate <-
  tidygate_data %>%
  mutate( gate = gate_chr( Dim1, Dim2 ) )


tidygate_gate

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


Try the tidygate package in your browser

Any scripts or data that you put into this service are public.

tidygate documentation built on Jan. 20, 2022, 5:12 p.m.