teal_slices-utilities: 'teal_slices' utility functions

teal_slices-utilitiesR Documentation

teal_slices utility functions

Description

Helper functions for working with teal_slices object.

Usage

is.teal_slices(x)

as.teal_slices(x)

## S3 method for class 'teal_slices'
as.list(x, recursive = FALSE, ...)

## S3 method for class 'teal_slices'
x[i]

## S3 method for class 'teal_slices'
c(...)

## S3 method for class 'teal_slices'
format(x, show_all = FALSE, trim_lines = TRUE, ...)

## S3 method for class 'teal_slices'
print(x, ...)

Arguments

x

object to test for teal_slices, object to convert to teal_slices or a teal_slices object

recursive

(logical(1)) flag specifying whether to also convert to list the elements of this teal_slices

...

additional arguments passed to other functions.

i

(character or numeric or logical) indicating which elements to extract

show_all

(logical(1)) whether to display non-null elements of constituent teal_slice objects

trim_lines

(logical(1)) whether to trim lines

Examples

filter_1 <- teal_slice(
  dataname = "dataname1",
  varname = "varname1",
  choices = letters,
  selected = "b",
  keep_na = TRUE,
  fixed = FALSE,
  extra1 = "extraone"
)
filter_2 <- teal_slice(
  dataname = "dataname1",
  varname = "varname2",
  choices = 1:10,
  keep_na = TRUE,
  selected = 2,
  fixed = TRUE,
  anchored = FALSE,
  extra2 = "extratwo"
)
filter_3 <- teal_slice(
  dataname = "dataname2",
  varname = "varname3",
  choices = 1:10 / 10,
  keep_na = TRUE,
  selected = 0.2,
  fixed = TRUE,
  anchored = FALSE,
  extra1 = "extraone",
  extra2 = "extratwo"
)

all_filters <- teal_slices(
  filter_1,
  filter_2,
  filter_3,
  exclude_varnames = list(
    "dataname1" = "varname2"
  )
)

is.teal_slices(all_filters)
all_filters[1:2]
c(all_filters[1], all_filters[2])
print(all_filters)
print(all_filters, trim_lines = FALSE)


teal.slice documentation built on May 29, 2024, 1:39 a.m.