Learn R Programming

omopgenerics (version 1.4.1)

filterResult: Filter a <summarised_result> automatically

Description

Filter a <summarised_result> automatically

Usage

filterResult(result, ...)

Value

A <summarised_result> object with only the rows that satisfy the specified filters.

Arguments

result

A <summarised_result> object.

...

Expressions that return a logical value. The columns used in the expressions can be stored in the settings, strata, group, or additional columns. filterResult() looks for columns using this hierarchy: settings, strata, group, then additional. If multiple expressions are included, they are combined with the & operator. Only rows for which all conditions evaluate to TRUE are kept.

Examples

Run this code
library(dplyr)
library(omopgenerics)

x <- tibble(
  "result_id" = 1L,
  "cdm_name" = "eunomia",
  "group_name" = "cohort_name",
  "group_level" = "my_cohort",
  "strata_name" = "sex",
  "strata_level" = "Female",
  "variable_name" = "number subjects",
  "variable_level" = NA_character_,
  "estimate_name" = "count",
  "estimate_type" = "integer",
  "estimate_value" = "100",
  "additional_name" = "overall",
  "additional_level" = "overall"
) |>
  newSummarisedResult(settings = tibble(
    "result_id" = 1L, "analysis" = "overall"
  ))

x |>
  filterResult(cohort_name == "my_cohort", sex == "Female")

Run the code above in your browser using DataLab