table_format: Identify if a dataframe has a long or a wide format

View source: R/split_mixed.R

table_formatR Documentation

Identify if a dataframe has a long or a wide format

Description

A dataset is either in the wide format or in the long format (link). This function identifies the format of a dataframe with respect to a subject ID. If a dataframe has some wide and long columns, it is considered "mixed".

Usage

table_format(
  df,
  id = get_subjid_cols(),
  ...,
  ignore_cols = get_meta_cols(0.95),
  na_rm = FALSE,
  warn = TRUE
)

Arguments

df

a dataframe

id

the identifying subject ID

...

not used

ignore_cols

columns to ignore. Usually meta columns (see get_meta_cols).

na_rm

whether to consider missing values

warn

whether to warn if ID is not found

Value

a string value in ⁠c("wide", "long", "mixed)⁠

Examples

tm = edc_example_mixed()
sapply(tm, table_format, warn=FALSE) 

EDCimport documentation built on April 4, 2025, 1:18 a.m.