knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of flowhelperrr is to help you (me) do flow cytometry analysis in R using data frames.
The main reason this package exists was that I kept re-writting many functions in many of the analyses I did of my flow cytometry data. Therefore, this package is not mean to become available through cran or particularly light on dependencies/imports.
devtools::install_github("jspaezp/flowhelperrr")
library(flowhelperrr) library(ggplot2) ## basic example code
Gates can be defined as polygons in a data frame. Such data frames can be used to check what points are inside such polygons.
poly_selection <- data.frame( Petal.Length = c(2,4,6), Sepal.Width = c(2,4,2)) is_point_in_path( iris$Petal.Length, iris$Sepal.Width, poly_selection)
Since it is vectorized it can be used as well in NSE
iris2 <- dplyr::mutate( iris, point_in_poly = is_point_in_path( Petal.Length, Sepal.Width, poly_selection)) head(iris2)
ggplot(iris, aes(x = Petal.Length, y = Sepal.Width, colour = is_point_in_path(Petal.Length, Sepal.Width, poly_selection))) + geom_point() + geom_polygon(colour = "gray", alpha = 0.3, data = poly_selection) + theme(legend.position = "bottom")
Gadgets are provided to help with the things that are hard to do exclusively on the command line (such as making an octagonal gate ...)
ggpolygon
This gadget allows you to click to form a polygon and returns a data frame that defines such polygon
ggpolygon(iris, "Sepal.Length", "Petal.Length")
To generate the data.frame, type 'data.frame(c(5.29656915230736, 5.62182752573929, 6.26495203684332, 7.28508057169799, 6.64195606059396), c(4.65156384997072, 3.41011046538746, 3.74383449350124, 4.9852878780845, 6.50706944628333))' Sepal.Length Petal.Length 1 5.296569 4.651564 2 5.621828 3.410110 3 6.264952 3.743834 4 7.285081 4.985288 5 6.641956 6.507069
devtools::test() devtools::build_readme() devtools::document() devtools::build_site()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.