has_tag: A selector function to use in 'tidyverse' functions

View source: R/has_tag.R

has_tagR Documentation

A selector function to use in tidyverse functions

Description

A selector function to use in tidyverse functions

Usage

has_tag(tags)

Arguments

tags

A character vector of tags listing the variables you want to operate on

Value

A numeric vector containing the position of the columns with the requested tags

Examples

if (require(outbreaks) && require(dplyr)) {

  ## dataset we'll create a linelist from
  measles_hagelloch_1861

  ## create linelist
  x <- make_linelist(measles_hagelloch_1861,
    id = "case_ID",
    date_onset = "date_of_prodrome",
    age = "age",
    gender = "gender"
  )
  head(x)

  x %>%
    select(has_tag(c("id", "age"))) %>%
    head()
}

epiverse-trace/linelist documentation built on April 26, 2024, 5:35 a.m.