dot-table_as_df: Results from 'table()' as Data Frame

.table_as_dfR Documentation

Results from table() as Data Frame

Description

Takes the results from table() and returns them as a data frame. After the table() results are made into a data frame, all the variables are made into character columns, and the function also restores the column types to their original classes. For strata columns, only observed combinations are returned.

Usage

.table_as_df(
  data,
  variable = NULL,
  by = NULL,
  strata = NULL,
  useNA = c("no", "always"),
  count_column = "...ard_n..."
)

Arguments

data

(data.frame)
a data frame

variable

(string)
a string indicating a column in data

by

(character)
a character vector indicating columns in data

strata

(character)
a character vector indicating columns in data

useNA

(string)
one of "no" and "always". Will be passed to table(useNA).

Value

data frame

Examples

cards:::.table_as_df(ADSL, variable = "ARM", by = "AGEGR1", strata = NULL)

cards documentation built on Oct. 4, 2024, 1:09 a.m.