Description Usage Arguments Value Examples
This function takes as input one object containing a test result and returns its most important informations. Function lmText takes the result of a regression (returned from a call to the lm function), returning either its global statistics – R², F-value (with corresponding model and residuals degrees of freedom) and P-value – or statistics for specific coefficients. In addition, it offers options to customize the output, like replacing names of some parameters, changing separators and decimal markers (helpful in case you are producing a manuscript in German or Portuguese), and choosing the number of digits to round number to.
1 2 |
x |
Name of the object containing the result of the analysis from which stats should be extracted. |
type |
Either "global" for global model statistics or "coefs", for specific variable betas and their significance. The default is "global". |
sep |
How to separate pieces of information displayed. Defaults to a semicolon followed by a space (sep = "; "). |
dec |
Which decimal separator should be used? Defaults to ".". Allows to quickly changing to a comma in case you are producing a manuscript in German or Portuguese. |
digits |
How many digits should be kept for each piece of numeric information? Defaults to c(3, 3, 3). Importantly, when a P-value rounded to the number of digits hereby defined results in zero, the result is replaced by a more theoretically meaningful alternative (e.g. P < 0.001). |
adj.r.squared |
Logic value indicating whether an automatic shift to adjusted R² should be allowed for multivariate models. Default is TRUE. |
which.coef |
Vector indexing which of the potential many variables should be accessed when type = "coefs". |
A string of text to be included in a markdown object.
1 2 3 4 5 6 7 8 9 10 | ## loading the anorexia dataset
utils::data(anorexia, package = "MASS")
anorex.1 <- lm(Postwt ~ Prewt, data = anorexia)
lmText(anorex.1)
lmText(anorex.1, type="coefs", which.coef="Prewt")
lmText(anorex.1, type="coefs", which.coef=2)
anorex.2 <- lm(Postwt ~ Prewt + Treat, data = anorexia)
lmText(anorex.2)
lmText(anorex.2, type="coefs", which.coef="TreatCont")
lmText(anorex.2, type="coefs", which.coef=3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.