#create sample data with gaps
gapped_data <-
sample.data.environment |>
dplyr::filter(MEDI < 30000)
#check their status, based on the MEDI variable
gapped_data |> remove_partial_data(MEDI, handle.gaps = TRUE, show.result = TRUE)
#the function will produce a warning if implicit gaps are present
gapped_data |> remove_partial_data(MEDI, show.result = TRUE)
#one group (Environment) does not make the cut of 20% missing data
gapped_data |> remove_partial_data(MEDI, handle.gaps = TRUE) |> dplyr::count(Id)
#for comparison
gapped_data |> dplyr::count(Id)
#If the threshold is set differently, e.g., to 2 days allowed missing, results vary
gapped_data |>
remove_partial_data(MEDI, handle.gaps = TRUE, threshold.missing = "2 days") |>
dplyr::count(Id)
#The removal can be automatically switched to daily detections within groups
gapped_data |>
remove_partial_data(MEDI, handle.gaps = TRUE, by.date = TRUE, show.result = TRUE) |>
head()
Run the code above in your browser using DataLab