Learn R Programming

cards (version 0.3.0)

.table_as_df: 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..."
)

Value

data frame

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).

Examples

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

Run the code above in your browser using DataLab