This function replaces values in columns x
, y
, and confidence
with NA
if the confidence values are below a specified threshold.
Usage
filter_na_confidence(data, threshold = 0.6)
Arguments
- data
A data frame containing the columns x
, y
, and confidence
.
- threshold
A numeric value specifying the minimum confidence level to
retain data. Default is 0.6.
Value
A data frame with the same structure as the input, but where x
, y
,
and confidence
values are replaced with NA
if the confidence is below the threshold.
Examples
library(dplyr)
data <- dplyr::tibble(
x = 1:5,
y = 6:10,
confidence = c(0.5, 0.7, 0.4, 0.8, 0.9)
)
filter_na_confidence(data, threshold = 0.6)
#> # A tibble: 5 × 3
#> x y confidence
#> <int> <int> <dbl>
#> 1 NA NA NA
#> 2 2 7 0.7
#> 3 NA NA NA
#> 4 4 9 0.8
#> 5 5 10 0.9