Use rich-text formatting (R markdown) to output the content of
R objects by using kable()
or pander()
functions. Output are
readable at the R console, inside inline elements in an R Notebook and in
HTML, LaTeX or Word documents. Moreover, they are translatable in different
languages lang =
argument, and labels and/or units for variables
can also be used in place of the name of these variables.
form(x, ...) # S3 method for default form( x, caption = attr(x, "caption"), digits = 2, ..., data = NULL, options = list(digits = digits, missing = "", table.style = "rmarkdown"), table_split = 120L, table_row_align = "left", lang = getOption("data.io_lang", "en") ) # S3 method for anova form( x, caption = attr(x, "caption"), data = NULL, signif_stars = TRUE, ..., lang = getOption("data.io_lang", "en") ) # S3 method for data.frame form( x, caption = attr(x, "caption"), data = NULL, labels = TRUE, units = TRUE, ..., lang = getOption("data.io_lang", "en") ) # S3 method for summary.lm form( x, caption = attr(x, "caption"), data = NULL, summary = TRUE, digits = 3, signif_stars = TRUE, ..., lang = getOption("data.io_lang", "en") ) # S3 method for lm form( x, caption = attr(x, "caption"), data = NULL, digits = 2, signif_stars = TRUE, ..., lang = getOption("data.io_lang", "en") ) # S3 method for summary.glm form( x, caption = attr(x, "caption"), data = NULL, summary = TRUE, digits = 3, signif_stars = TRUE, ..., lang = getOption("data.io_lang", "en") ) # S3 method for summary.nls form( x, caption = attr(x, "caption"), data = NULL, summary = TRUE, digits = 3, signif_stars = TRUE, ..., lang = getOption("data.io_lang", "en") ) # S3 method for nls form( x, caption = attr(x, "caption"), data = NULL, params_labels, digits = 2, signif_stars = TRUE, ..., lang = getOption("data.io_lang", "en") )
x | An R object |
---|---|
... | Further arguments (depends on the class of |
caption | Legend for tables (if |
digits | Number of digits to print |
data | A data frame or tibble to be used to extract labels and/units |
options | Pander options (see |
table_split | Number of characters to accept for the width of the table
before splitting it ( |
table_row_align | How to align table row names ( |
lang | The language to use for the output. By default, it is the
|
signif_stars | For |
labels | Should we use labels for column names? |
units | Should we add units to labels in column names? |
summary | Should we add a summary of the object? |
params_labels | The label to use for the parameters. |
A character string with the formatted results
#> #>#>#> #>options(data.io_lang = "FR") trees <- read("trees", package = "datasets") lm_1 <- lm(data = trees, volume ~ .) form(trees)#> #> #> | Diamètre à 1,4m [m] | Hauteur [m] | Volume de bois [m^3^] | #> |:-------------------:|:-----------:|:---------------------:| #> | 0,21 | 21 | 0,29 | #> | 0,22 | 20 | 0,29 | #> | 0,22 | 19 | 0,29 | #> | 0,27 | 22 | 0,46 | #> | 0,27 | 25 | 0,53 | #> | 0,27 | 25 | 0,56 | #> | 0,28 | 20 | 0,44 | #> | 0,28 | 23 | 0,52 | #> | 0,28 | 24 | 0,64 | #> | 0,28 | 23 | 0,56 | #> | 0,29 | 24 | 0,69 | #> | 0,29 | 23 | 0,59 | #> | 0,29 | 23 | 0,61 | #> | 0,3 | 21 | 0,6 | #> | 0,3 | 23 | 0,54 | #> | 0,33 | 23 | 0,63 | #> | 0,33 | 26 | 0,96 | #> | 0,34 | 26 | 0,78 | #> | 0,35 | 22 | 0,73 | #> | 0,35 | 20 | 0,7 | #> | 0,36 | 24 | 0,98 | #> | 0,36 | 24 | 0,9 | #> | 0,37 | 23 | 1 | #> | 0,41 | 22 | 1,1 | #> | 0,41 | 24 | 1,2 | #> | 0,44 | 25 | 1,6 | #> | 0,44 | 25 | 1,6 | #> | 0,46 | 24 | 1,7 | #> | 0,46 | 24 | 1,5 | #> | 0,46 | 24 | 1,4 | #> | 0,52 | 26 | 2,2 | #>#> #> #> | Diamètre à 1,4m [m] | Hauteur [m] | Volume de bois [m^3^] | #> |:-------------------:|:-----------:|:---------------------:| #> | 0,21 | 21 | 0,29 | #> | 0,22 | 20 | 0,29 | #> | 0,22 | 19 | 0,29 | #> | 0,27 | 22 | 0,46 | #> | 0,27 | 25 | 0,53 | #> | 0,27 | 25 | 0,56 | #>#> #> #> | | DDL | Somme carrés | Carrés moyens | Stat. _F_ | Valeur _p_ | | #> |:--------------------|:---:|:------------:|:-------------:|:---------:|:----------:|:-----:| #> | **Diamètre à 1,4m** | 1 | 6,1 | 6,1 | 499 | 2,2e-19 | * * * | #> | **Hauteur** | 1 | 0,081 | 0,081 | 6,6 | 0,016 | * | #> | **Résidus** | 28 | 0,34 | 0,012 | | | | #> #> Table: Analyse de la variance - Réponse : Volume de bois #> #> Signif. codes: 0 '\*\*\*' 0.001 '\*\*' 0.01 '\*' 0.05 '.' 0.1 ' ' 1#> NULL