Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

as_huxtable

Convert table to huxtable


Description

This function converts a etable object to a huxtable. The huxtable-package needs to be installed to use this function.

Usage

as_huxtable.etable(x, ...)

as_hux.etable(x, ...)

Arguments

x

etable. Table to convert to a huxtable.

...

arguments passed on to huxtable.

Details

huxtable allows to export formated tables to LaTeX, HTML, Microsoft Word, Microsoft Excel, Microsoft Powerpoint, RTF and Markdown.

Tables in knitr or rmarkdown documents of type LaTeX or Word are converted by default.

Examples

## Not run:  
library(huxtable)
data(mtcars)
mtcars = apply_labels(mtcars,
                      mpg = "Miles/(US) gallon",
                      cyl = "Number of cylinders",
                      disp = "Displacement (cu.in.)",
                      hp = "Gross horsepower",
                      drat = "Rear axle ratio",
                      wt = "Weight (1000 lbs)",
                      qsec = "1/4 mile time",
                      vs = "Engine",
                      vs = c("V-engine" = 0,
                             "Straight engine" = 1),
                      am = "Transmission",
                      am = c("Automatic" = 0,
                             "Manual"=1),
                      gear = "Number of forward gears",
                      carb = "Number of carburetors"
)

tab = mtcars %>% 
    tab_cols(total(), am %nest% vs) %>% 
    tab_cells(mpg, hp) %>% 
    tab_stat_mean() %>% 
    tab_cells(cyl) %>% 
    tab_stat_cpct() %>% 
    tab_pivot() %>% 
    set_caption("Table 1. Some variables from mtcars dataset.")

ht = as_huxtable(tab)
ht

## End(Not run)

expss

Tables, Labels and Some Useful Functions from Spreadsheets and 'SPSS' Statistics

v0.10.7
GPL (>= 2)
Authors
Gregory Demin [aut, cre], Sebastian Jeworutzki [ctb] (<https://orcid.org/0000-0002-2671-5253>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.