View source: R/cluster_events.R
trim_population | R Documentation |
Remove the points furthest form the center of the cluster.
trim_population(
df,
.parameter,
.column_name = "population",
.trim = 0.1,
.data = NULL
)
df |
The tidy data.frame with clusters to be modified. |
.parameter |
A character giving the name of dimensions to calculate distance on. |
.column_name |
A character giving the name of the column with the cluster information. |
.trim |
A numeric between 0 and 1, giving the fraction of points to remove. |
.data |
Deprecated. Use |
The euclidean distance is calculated for each point defined by
.parameter
to the center of the cluster. The cluster designation of
the .trim
most distant points are changed to NA
.
A data.frame
library(beadplexr)
library(dplyr)
library(ggplot2)
data("lplex")
lplex[[1]] |>
filter(`FSC-A` > 3.2e5L) |>
mutate(population = "1") |>
trim_population(.parameter = c("FSC-A", "SSC-A"), .column_name = "population", .trim = 0.1) |>
ggplot() +
aes(x = `FSC-A`, y = `SSC-A`, colour = population) +
geom_point()
lplex[[1]] |>
filter(`FSC-A` > 3.2e5L) |>
mutate(population = "1") |>
trim_population(.parameter = c("FSC-A", "SSC-A"),
.column_name = "population", .trim = 0.8) |>
ggplot() +
aes(x = `FSC-A`, y = `SSC-A`, colour = population) +
geom_point()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.