# Numerics

    library(textab)

Basic numeric row:

    vec <- c(1.0, 1.01, 1.001)
    TexRow(vec)
    #> % created using textab on Tue Apr 25 07:41:51 2023
    #> \begin{tabular}{rrr}
    #> 1.000 & 1.010 & 1.001 \\
    #> \end{tabular}

## 1. Rounding

Numeric row rounded to the second decimal place:

    vec <- c(1.0, 1.01, 1.001)
    TexRow(vec, dec = 2)
    #> % created using textab on Tue Apr 25 07:41:51 2023
    #> \begin{tabular}{rrr}
    #> 1.00 & 1.01 & 1.00 \\
    #> \end{tabular}

Entry-specific rounding:

    vec <- c(1.0, 1.01, 1.001)
    TexRow(vec, dec = c(2,4,6))
    #> % created using textab on Tue Apr 25 07:41:51 2023
    #> \begin{tabular}{rrr}
    #> 1.00 & 1.0100 & 1.001000 \\
    #> \end{tabular}

## 2. Percentage

Numeric row where all numbers are percentages:

    vec <- c(20,30,40)
    TexRow(vec, dec = 0, percentage = TRUE)
    #> % created using textab on Tue Apr 25 07:41:51 2023
    #> \begin{tabular}{rrr}
    #> 20\% & 30\% & 40\% \\
    #> \end{tabular}

Only some entries are percentages:

    vec <- c(2.4344, 40.12)
    TexRow(vec, dec = c(2,1), percentage = c(FALSE, TRUE))
    #> % created using textab on Tue Apr 25 07:41:51 2023
    #> \begin{tabular}{rr}
    #> 2.43 & 40.1\% \\
    #> \end{tabular}

## 3. Dollar Sign

Numeric row where all numbers are dollars:

    vec <- c(20.32,30.67,40.98)
    TexRow(vec, dec = 2, dollar = TRUE)
    #> % created using textab on Tue Apr 25 07:41:51 2023
    #> \begin{tabular}{rrr}
    #> \$20.32 & \$30.67 & \$40.98 \\
    #> \end{tabular}

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))
    #> % created using textab on Tue Apr 25 07:41:51 2023
    #> \begin{tabular}{rr}
    #> \$2.43 & 40.1\% \\
    #> \end{tabular}

## 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)
    #> % created using textab on Tue Apr 25 07:41:51 2023
    #> \begin{tabular}{rrr}
    #> (20.32) & (30.67) & (40.98) \\
    #> \end{tabular}

Only some entries are standard errors:

    vec <- c(2.4344, 0.3815)
    TexRow(vec, dec = 3, se = c(FALSE, TRUE))
    #> % created using textab on Tue Apr 25 07:41:51 2023
    #> \begin{tabular}{rr}
    #> 2.434 & (0.382) \\
    #> \end{tabular}

## 5. p-values

Infer p-value from numeric vector:

- `p < 0.1` gives 1 star
- `p < 0.05` gives 2 stars
- `p < 0.01` gives 3 stars

    vec <- c(1,2,3)
    TexRow(vec, dec = 2, pvalues = c(0.09, 0.04, 0.009))
    #> % created using textab on Tue Apr 25 07:41:51 2023
    #> \begin{tabular}{rrr}
    #> 1.00* & 2.00** & 3.00*** \\
    #> \end{tabular}