data_vlist2latex: data + vlist -> latex table (experimental)

View source: R/dtables.R

data_vlist2latexR Documentation

data + vlist -> latex table (experimental)

Description

Create a dtables from data and make a nice table with "rgroup:s" using a list that groups variables

Usage

data_vlist2latex(
  data,
  guide = NULL,
  var.list = NULL,
  caption = NULL,
  caption.lot = caption,
  label = NULL,
  longtable = FALSE,
  ...,
  format = TRUE,
  format.param = as.list(NULL),
  n = c(n = "size"),
  tot.name = "All",
  attach = FALSE,
  attach.path = "table",
  attach.name = NULL
)

Arguments

data

a data frame to be described

guide

a dtable guide

var.list

a variable list

caption

caption

caption.lot

caption for list of tables

label

label

longtable

use longtable?

...

arguments passed to dtables

format

logical; want formatting?

format.param

list; formatting parameters

n

size indicator in table (set to NULL to suppress this)

tot.name

name of single column (if no glist)

Examples

n = 100
d <- data.frame(
    id = sprintf("id%s", 1:n),
    age = rpois(n, 65),
    sex = sample(c("M", "F"), n, replace = TRUE),
    meas1 = rnorm(n, 10),
    meas2 = rnorm(n, 20),
    dag = as.Date("2020-01-01") + runif(n, min = 0, max = 365)
)
vlist = list(
    "ID" = c(id = "Identity code"),
    "Foo bar" = c(age = 'Age (years)',
                  sex = 'Biological gender',
                  dag = 'Index date'),
    "Baz quuz" = c(meas1 = 'Hiphopinin',
                   meas2 = 'Jazzerum')
)
g <- dtable_guide(d, unit.id = "id", no.bnry = TRUE)
data_vlist2latex(data = d, guide = g, var.list = vlist)
gl <- make_glist(x = "sex", ref = d)
data_vlist2latex(data = d, guide = g, var.list = vlist,
                 glist = gl, comp = TRUE, test = TRUE)

renlund/descripteur documentation built on Sept. 24, 2023, 7:07 p.m.