tablet.tablette: Convert to tablette from tablet.

View source: R/tablette.R

tablet.tabletteR Documentation

Convert to tablette from tablet.

Description

Converts to 'tablette' from 'tablet'. I.e., makes compact data.frame that emulates the layout expected by as_kable. Preserves attributes 'n', 'label', 'codelist', and 'latex' class if present.

Usage

## S3 method for class 'tablette'
tablet(x, ...)

Arguments

x

object of dispatch

...

passed arguments

Value

tablette : a data.frame with columns for each combination of groups, and:

_tablet_name

observation identifier: character, possibly 'latex'; has a codelist attribute the values of which are the original column names

_tablet_level

factor level, or the LHS of formulas in 'num'

All (or value of 'all' argument)

ungrouped results

See Also

Other tablet: as_tablet.data.frame(), as_tablet(), header_rows.tablet(), header_rows(), tablette.tablet()

Examples

library(boot)
library(dplyr)
library(magrittr)
library(yamlet)
rm(melanoma)
melanoma %<>% select(-time, -year) 
melanoma %<>% decorate('
time:      [ Survival Time Since Operation, day               ]
status:    [ End of Study Patient Status,
           [ Alive: 2, Melanoma Death: 1, Unrelated Death: 3 ]]
sex:       [ Sex, [ Male: 1, Female: 0                       ]]
age:       [ Age at Time of Operation, year                   ]
thickness: [ Tumor Thickness, mm                              ]
ulcer:     [ Ulceration, [ Absent: 0, Present: 1             ]]
')
melanoma %<>% resolve
melanoma %<>% group_by(status, ulcer) 
melanoma %<>% tablet 
melanoma %>% header_rows
melanoma %>% as_kable
melanoma %>% tablette
melanoma %>% tablette %>% tablet
identical(melanoma, tablet(tablette(melanoma)))
  

tablet documentation built on Sept. 16, 2023, 1:08 a.m.