| despeckle {beadplexr} | R Documentation |
Despeckle parameters
Description
Remove lonely, noisy data points in a 2D scatter matrix
Usage
despeckle(df, .parameters, .bins = 256L, .neighbours = 4L, .data = NULL, ...)
Arguments
df |
A tidy data.frame. |
.parameters |
A character of the length of two giving the parameters to despeckle. |
.bins |
A numeric giving the resolution of the raster matrix. Increasing the resolution results in more isolated events. |
.neighbours |
A numeric giving the minimum number of neighbours. Points with fewer neighbours are removed. |
.data |
Deprecated. Use |
... |
Deprecated. It's use has no effect. |
Details
The values of the two parameters are binned into the given number of bins.
They are then cast into a 2D matrix, with the bins of the first of the
parameters ending up as rows, the bins of the second parameter as
columns, and combinations are marked by 1.
The rows of the df where lonely points are found in .parameters are removed.
Value
A data.frame with noisy points removed.
Examples
library(beadplexr)
library(ggplot2)
data("lplex")
lplex[[1]] |>
ggplot() +
aes(x = `FL6-H`, y = `FL2-H`) +
geom_point()
lplex[[1]] |>
despeckle(.parameters = c("FL6-H", "FL2-H"), .neighbours = 8) |>
ggplot() +
aes(x = `FL6-H`, y = `FL2-H`) +
geom_point()
lplex[[1]] |>
despeckle(.parameters = c("FL6-H", "FL2-H"), .bin = 128) |>
ggplot() +
aes(x = `FL6-H`, y = `FL2-H`) +
geom_point()