diff --git a/DESCRIPTION b/DESCRIPTION index d45b74b..3169bc8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: JACUSA2helper Type: Package Title: Post-processing for JACUSA2 output -Version: 1.98 +Version: 1.98-1 Depends: R (>= 2.10) Date: 2019-11-10 Author: Michael Piechotta diff --git a/NAMESPACE b/NAMESPACE index ae68148..4c22000 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -22,6 +22,7 @@ export(copy_attr) export(cov_col) export(coverage) export(extract_ref) +export(filter_all_artefacts) export(filter_artefact) export(filter_by) export(filter_by_max_score) diff --git a/R/helper-filter.R b/R/helper-filter.R index c5e2b7d..82c613e 100644 --- a/R/helper-filter.R +++ b/R/helper-filter.R @@ -40,3 +40,19 @@ filter_artefact <- function(filter, artefacts) { grepl(paste0(artefacts, collapse = "|"), filter) } + +#' Filters all sites with an artefact +#' +#' Removes sites that sites that have been marked by any feature/artefact filter. +#' @param filter vector of strings that contains artefact filter information. +#' @return vector of logical. +#' @examples +#' data(rdd) +#' # remove sites that are marked by artefact filter "D" +#' grouped <- group_by_site(rdd) +#' filtered <- filter_by(grouped, filter_all_artefacts(filter)) +#' str(filtered) +#' @export +filter_all_artefacts <- function(filter) { + filter_artefact(filter, c(paste0('\\', EMPTY))) +} diff --git a/man/filter_all_artefacts.Rd b/man/filter_all_artefacts.Rd new file mode 100644 index 0000000..a34f40f --- /dev/null +++ b/man/filter_all_artefacts.Rd @@ -0,0 +1,24 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/helper-filter.R +\name{filter_all_artefacts} +\alias{filter_all_artefacts} +\title{Filters all sites with an artefact} +\usage{ +filter_all_artefacts(filter) +} +\arguments{ +\item{filter}{vector of strings that contains artefact filter information.} +} +\value{ +vector of logical. +} +\description{ +Removes sites that sites that have been marked by any feature/artefact filter. +} +\examples{ +data(rdd) +# remove sites that are marked by artefact filter "D" +grouped <- group_by_site(rdd) +filtered <- filter_by(grouped, filter_all_artefacts(filter)) +str(filtered) +}