Numerics

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(textab)

Basic numeric row:

vec <- c(1.0, 1.01, 1.001)
TexRow(vec)

1. Rounding

Numeric row rounded to the second decimal place:

vec <- c(1.0, 1.01, 1.001)
TexRow(vec, dec = 2)

Entry-specific rounding:

vec <- c(1.0, 1.01, 1.001)
TexRow(vec, dec = c(2,4,6))

2. Percentage

Numeric row where all numbers are percentages:

vec <- c(20,30,40)
TexRow(vec, dec = 0, percentage = TRUE)

Only some entries are percentages:

vec <- c(2.4344, 40.12)
TexRow(vec, dec = c(2,1), percentage = c(FALSE, TRUE))

3. Dollar Sign

Numeric row where all numbers are dollars:

vec <- c(20.32,30.67,40.98)
TexRow(vec, dec = 2, dollar = TRUE)

Only some entries are in dollars:

vec <- c(2.4344, 40.12)
TexRow(vec, dec = c(2,1), percentage = c(FALSE, TRUE), dollar = c(TRUE, FALSE))

4. Standard Error

Numeric row where all numbers are standard errors:

vec <- c(20.32,30.67,40.98)
TexRow(vec, dec = 2, se = TRUE)

Only some entries are standard errors:

vec <- c(2.4344, 0.3815)
TexRow(vec, dec = 3, se = c(FALSE, TRUE))

5. p-values

Infer p-value from numeric vector:

vec <- c(1,2,3)
TexRow(vec, dec = 2, pvalues = c(0.09, 0.04, 0.009))


Try the textab package in your browser

Any scripts or data that you put into this service are public.

textab documentation built on April 25, 2023, 5:10 p.m.