Skip to contents

These filter_*() functions are used to subset a data frame. Each function subsets rows based on the value of one column. For numeric columns, a row will be kept if the value is greater than or equal to the value specified. For categorical columns, a row will be kept if the value is equal to the value specified. Note that when a condition evaluates to NA the row will be dropped, unlike base subsetting with [.

Usage

filter_aa_change(.data, .value, .preserve = FALSE)

filter_alt_umi_count(.data, .value, .preserve = FALSE)

filter_coverage(.data, .value, .preserve = FALSE)

filter_gene(.data, .value, .preserve = FALSE)

filter_mutation_name(.data, .value, .preserve = FALSE)

filter_ref_umi_count(.data, .value, .preserve = FALSE)

filter_targeted(.data, .value, .preserve = FALSE)

Arguments

.data

A data frame, data frame extension (e.g. a tibble), or a lazy data frame (e.g. from dbplyr or dtplyr).

.value

The filtering value to be applied.

.preserve

Relevant when the .data input is grouped. If .preserve = FALSE (the default), the grouping structure is recalculated based on the resulting data, otherwise the grouping is kept as is.

See also

dplyr::filter() for more complex filtering operations.

Examples

data <- tibble::tribble(
  ~sample, ~gene, ~coverage,
  "S1", "atp6", 10,
  "S2", "crt", 20,
)
filter_gene(data, "atp6")
#> Warning: This function provides a simple filtering interface.
#>  For more complex filtering, please use `dplyr::filter()`.
#> This warning is displayed once every 8 hours.
#> # A tibble: 1 × 3
#>   sample gene  coverage
#>   <chr>  <chr>    <dbl>
#> 1 S1     atp6        10
filter_coverage(data, 15)
#> Warning: This function provides a simple filtering interface.
#>  For more complex filtering, please use `dplyr::filter()`.
#> This warning is displayed once every 8 hours.
#> # A tibble: 1 × 3
#>   sample gene  coverage
#>   <chr>  <chr>    <dbl>
#> 1 S2     crt         20