Type: | Package |
Title: | Create Report Table from Different Objects |
Version: | 0.1.7 |
Author: | David Hervas Marin |
Maintainer: | David Hervas Marin <ddhervas@yahoo.es> |
Imports: | boot, flextable, lme4, lmerTest, methods, officer, xtable |
Description: | Tools for generating descriptives and report tables for different models, data.frames and tables and exporting them to different formats. |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.1.1 |
NeedsCompilation: | no |
Packaged: | 2021-03-19 14:57:03 UTC; aghil |
Repository: | CRAN |
Date/Publication: | 2021-03-22 09:40:02 UTC |
Generic VarCorr function
Description
Extract Variance-Covariance Matrix.
Usage
VarCorr(x, sigma = 1, ...)
Arguments
x |
A model object |
sigma |
Optional value used as a multiplier for the standard deviations |
... |
Further arguments passed to VarrCorr methods |
Value
A Variance-Covariance Matrix
Plot of the coefficients of a model
Description
Creates a plot of the coefficients of a model.
Usage
coefplot(
coefs,
lwr.int = coefs,
upper.int = coefs,
offset = 0,
coefnames = names(coefs),
abline.pos = 0,
sorted = FALSE,
reverse = FALSE,
pch = 16,
xlim = c(min(lwr.int, na.rm = TRUE), max(upper.int, na.rm = TRUE)),
ylim = c(1, length(coefs)),
color = "black",
...
)
Arguments
coefs |
A vector with each coefficient |
lwr.int |
A vector with the lower end of the CI |
upper.int |
A vector with the upper end of the CI |
offset |
Y-axis offset for the coefficients |
coefnames |
Name for each variable |
abline.pos |
Position for the vertical reference line |
sorted |
Should the coefficients be sorted from highest to lowest? |
reverse |
Should the order be reversed? |
pch |
Type of point |
xlim |
Limits of the X-axis |
ylim |
Limits of the Y-axis |
color |
Color for the points |
... |
Further arguments passed to axis() |
Value
A plot of the coefficients with their CI
Examples
lm1 <- lm(Petal.Length ~ Sepal.Width + Species, data=iris)
a<-report(lm1)
oldpar <- par()
par(mar=c(4, 10, 3, 2))
#Coefplot calling plot.reportmodel
plot(a)
par(mar=oldpar$mar) #Restore old margin values
#Manual coefplot
coefplot(coefs=c(1, 2, 3), lwr.int=c(0, 1, 2), upper.int=c(5, 6, 7), coefnames=c("A", "B", "C"))
Export a table to excel
Description
Exports a table to Excel.
Usage
make_csv_table(x, file, info)
Arguments
x |
A data.frame object |
file |
Name of the file |
info |
Footer for the table |
Value
Creates a .csv file with the table
Export a table to latex
Description
Exports a table to latex.
Usage
make_latex_table(x, file)
Arguments
x |
A data.frame object |
file |
Name of the file |
Value
Creates a .txt file with latex code for the table
Make a table from report
Description
Auxiliary function to create tables.
Usage
make_table(x, file, type, info = NULL, ...)
Arguments
x |
A data.frame object |
file |
Name of the file |
type |
Type of file |
info |
Footer for the table |
... |
Additional parameters passed to make_word_table |
Value
Creates a file with the table
Export a table to word
Description
Exports a table to Word.
Usage
make_word_table(x, file, info = NULL, use.rownames = TRUE)
Arguments
x |
A data.frame object |
file |
Name of the file |
info |
Footer for the table |
use.rownames |
Should row names be added to the output? |
Value
Creates a word file with the table
Auxiliary matrix paste function
Description
Internal function for report.table
Usage
matrixPaste(..., sep = rep(" ", length(list(...)) - 1))
Arguments
... |
Matrices to paste |
sep |
Separator for the paste function |
Value
Returns a matrix with the different matrices used as input pasted together
Coefplot for reportmodel objects
Description
Creates a coefplot from the reportmodel object.
Usage
## S3 method for class 'reportmodel'
plot(x, ...)
Arguments
x |
A reportmodel object |
... |
Further arguments passed to coefplot |
Value
Returns a plot of each coefficient in the model with its 95
Examples
lm1 <- lm(Petal.Length ~ Sepal.Width + Species, data=iris)
a<-report(lm1)
oldpar <- par()
par(mar=c(4, 10, 3, 2))
plot(a) #Coefplot calling plot.reportmodel
par(mar=oldpar$mar)
Generic function for creating reporting tables
Description
Generic function for creating reporting tables.
Usage
report(x, ...)
Arguments
x |
An compatibleobject that can be summarized |
... |
further arguments passed to make_table |
Value
A data frame with the report table
Examples
report(iris) #Report of descriptive statistics
lm1 <- lm(Petal.Length ~ Sepal.Width + Species, data=iris)
report(lm1) #Report of model
Report from beta regression model
Description
Creates a report table from a beta regression model.
Usage
## S3 method for class 'betareg'
report(
x,
file = NULL,
type = "word",
digits = 3,
digitspvals = 3,
info = TRUE,
print = TRUE,
...
)
Arguments
x |
A betareg model object |
file |
Name of the file to export the table |
type |
Format of the file |
digits |
Number of decimals |
digitspvals |
Number of decimals for p-values |
info |
If TRUE, include call in the exported table |
print |
Should the report table be printed on screen? |
... |
Further arguments passed to make_table |
Value
A data frame with the report table
Report models from brms package
Description
Creates a report table from model fitted by brms.
Usage
## S3 method for class 'brmsfit'
report(
x,
file = NULL,
type = "word",
digits = 3,
info = TRUE,
print = TRUE,
...
)
Arguments
x |
A brms model object |
file |
Name of the file to export the table |
type |
Format of the file |
digits |
Number of decimals |
info |
If TRUE, include call in the exported table |
print |
Should the report table be printed on screen? |
... |
Further arguments passed to make_table |
Value
A data frame with the report table
Report from ordinal model
Description
Creates a report table from an ordinal model.
Usage
## S3 method for class 'clm'
report(
x,
file = NULL,
type = "word",
digits = 3,
digitspvals = 3,
info = TRUE,
print = TRUE,
...
)
Arguments
x |
An ordinal model object |
file |
Name of the file to export the table |
type |
Format of the file |
digits |
Number of decimals |
digitspvals |
Number of decimals for p-values |
info |
If TRUE, include call in the exported table |
print |
Should the report table be printed on screen? |
... |
Further arguments passed to make_table |
Value
A data frame with the report table
Report from ordinal mixed model
Description
Creates a report table from an ordinal mixed model.
Usage
## S3 method for class 'clmm'
report(
x,
file = NULL,
type = "word",
digits = 3,
digitspvals = 3,
info = TRUE,
print = TRUE,
...
)
Arguments
x |
An ordinal model object |
file |
Name of the file to export the table |
type |
Format of the file |
digits |
Number of decimals |
digitspvals |
Number of decimals for p-values |
info |
If TRUE, include call in the exported table |
print |
Should the report table be printed on screen? |
... |
Further arguments passed to make_table |
Value
A data frame with the report table
Report from cox regression model
Description
Creates a report table from a cox model.
Usage
## S3 method for class 'coxph'
report(
x,
file = NULL,
type = "word",
digits = 3,
digitspvals = 3,
info = TRUE,
print = TRUE,
...
)
Arguments
x |
A cox model object |
file |
Name of the file to export the table |
type |
Format of the file |
digits |
Number of decimals |
digitspvals |
Number of decimals for p-values |
info |
If TRUE, include call in the exported table |
print |
Should the report table be printed on screen? |
... |
Further arguments passed to make_table |
Value
A data frame with the report table
Report tables of summary data
Description
Creates a report table ready for publication.
Usage
## S3 method for class 'data.frame'
report(
x,
by = NULL,
file = NULL,
type = "word",
digits = 2,
digitscat = digits,
print = TRUE,
...
)
Arguments
x |
A data.frame object |
by |
Grouping variable for the report |
file |
Name of the file to export the table |
type |
Format of the file |
digits |
Number of decimal places |
digitscat |
Number of decimal places for categorical variables (if different to digits) |
print |
Should the report table be printed on screen? |
... |
further arguments passed to make_table() |
Value
Returns a summary table of the data in publication-friendly format
Examples
report(iris)
(reporTable<-report(iris, by="Species"))
class(reporTable)
Default function for report
Description
This is a default function for calling summary(x) on non-implemented classes.
Usage
## Default S3 method:
report(x, ...)
Arguments
x |
Any object without specific report function |
... |
further arguments passed to summary |
Value
A summary of the object
Report from categorical variable
Description
Creates a report table.
Usage
## S3 method for class 'factor'
report(x, ...)
Arguments
x |
A categorical variable |
... |
Further arguments passed to make_table |
Value
A data frame with the report table
Report from generalized linear model
Description
Creates a report table from a generalized linear model.
Usage
## S3 method for class 'glm'
report(
x,
file = NULL,
type = "word",
digits = 3,
digitspvals = 3,
info = TRUE,
print = TRUE,
...
)
Arguments
x |
A generalized linear model object |
file |
Name of the file to export the table |
type |
Format of the file |
digits |
Number of decimals |
digitspvals |
Number of decimals for p-values |
info |
If TRUE, include call in the exported table |
print |
Should the report table be printed on screen? |
... |
Further arguments passed to make_table |
Value
A data frame with the report table
Report from generalized linear mixed model
Description
Creates a report table from a generalized linear mixed model.
Usage
## S3 method for class 'glmerMod'
report(
x,
file = NULL,
type = "word",
digits = 3,
digitspvals = 3,
info = TRUE,
print = TRUE,
...
)
Arguments
x |
A generalized linear mixed model object |
file |
Name of the file to export the table |
type |
Format of the file |
digits |
Number of decimals |
digitspvals |
Number of decimals for p-values |
info |
If TRUE, include call in the exported table |
print |
Should the report table be printed on screen? |
... |
Further arguments passed to make_table |
Value
A data frame with the report table
Report from generalized linear mixed model from ADMB
Description
Creates a report table from a glmmadmb model.
Usage
## S3 method for class 'glmmadmb'
report(
x,
file = NULL,
type = "word",
digits = 3,
digitspvals = 3,
info = TRUE,
print = TRUE,
...
)
Arguments
x |
A generalized linear mixed model object (glmmabmb) |
file |
Name of the file to export the table |
type |
Format of the file |
digits |
Number of decimals |
digitspvals |
Number of decimals for p-values |
info |
If TRUE, include call in the exported table |
print |
Should the report table be printed on screen? |
... |
Further arguments passed to make_table |
Value
A data frame with the report table
Report models from glmnet package
Description
Creates a report table from models fitted by glmnet.
Usage
## S3 method for class 'glmnet'
report(
x,
s,
gamma = 1,
drop.zero = TRUE,
file = NULL,
type = "word",
digits = 3,
info = TRUE,
print = TRUE,
...
)
Arguments
x |
A glmnet model object |
s |
Value of lambda for estimating the coefficients |
gamma |
Value of gamma for estimating the coefficients (only used in relaxed fits) |
drop.zero |
Should zero coefficients be dropped? |
file |
Name of the file to export the table |
type |
Format of the file |
digits |
Number of decimals |
info |
If TRUE, include call in the exported table |
print |
Should the report table be printed on screen? |
... |
Further arguments passed to make_table |
Value
A data frame with the report table
Report from linear model
Description
Creates a report table from a linear model.
Usage
## S3 method for class 'lm'
report(
x,
file = NULL,
type = "word",
digits = 3,
digitspvals = 3,
info = TRUE,
print = TRUE,
...
)
Arguments
x |
A linear model object |
file |
Name of the file to export the table |
type |
Format of the file |
digits |
Number of decimals |
digitspvals |
Number of decimals for p-values |
info |
If TRUE, include call in the exported table |
print |
Should the report table be printed on screen? |
... |
Further arguments passed to make_table |
Value
A data frame with the report table
Report from linear mixed model
Description
Creates a report table from a linear mixed model.
Usage
## S3 method for class 'lmerMod'
report(
x,
file = NULL,
type = "word",
digits = 3,
digitspvals = 3,
info = TRUE,
print = TRUE,
...
)
Arguments
x |
A linear mixed model object |
file |
Name of the file to export the table |
type |
Format of the file |
digits |
Number of decimals |
digitspvals |
Number of decimals for p-values |
info |
If TRUE, include call in the exported table |
print |
Should the report table be printed on screen? |
... |
Further arguments passed to make_table |
Value
A data frame with the report table
Report from quantile mixed model
Description
Creates a report table from a quantile mixed model.
Usage
## S3 method for class 'lqmm'
report(
x,
file = NULL,
type = "word",
digits = 3,
digitspvals = 3,
info = TRUE,
print = TRUE,
...
)
Arguments
x |
A quantile model object |
file |
Name of the file to export the table |
type |
Format of the file |
digits |
Number of decimals |
digitspvals |
Number of decimals for p-values |
info |
If TRUE, include call in the exported table |
print |
Should the report table be printed on screen? |
... |
Further arguments passed to make_table |
Value
A data frame with the report table
Report from linear mixed model with pvalues
Description
Creates a report table from a linear mixed model.
Usage
## S3 method for class 'merModLmerTest'
report(
x,
file = NULL,
type = "word",
digits = 3,
digitspvals = 3,
info = TRUE,
print = TRUE,
...
)
Arguments
x |
A linear mixed model object |
file |
Name of the file to export the table |
type |
Format of the file |
digits |
Number of decimals |
digitspvals |
Number of decimals for p-values |
info |
If TRUE, include call in the exported table |
print |
Should the report table be printed on screen? |
... |
Further arguments passed to make_table |
Value
A data frame with the report table
Report from numeric variable
Description
Creates a report table.
Usage
## S3 method for class 'numeric'
report(x, ...)
Arguments
x |
A numeric variable |
... |
Further arguments passed to make_table |
Value
A data frame with the report table
Report from robust linear model (rlm)
Description
Creates a report table from a robust linear model.
Usage
## S3 method for class 'rlm'
report(
x,
file = NULL,
type = "word",
digits = 3,
digitspvals = 3,
info = TRUE,
print = TRUE,
...
)
Arguments
x |
A rlm object |
file |
Name of the file to export the table |
type |
Format of the file |
digits |
Number of decimals |
digitspvals |
Number of decimals for p-values |
info |
If TRUE, include call in the exported table |
print |
Should the report table be printed on screen? |
... |
Further arguments passed to make_table |
Value
A data frame with the report table
Report from quantile regression model
Description
Creates a report table from a quantile regression model.
Usage
## S3 method for class 'rq'
report(
x,
file = NULL,
type = "word",
digits = 3,
digitspvals = 3,
info = TRUE,
print = TRUE,
...
)
Arguments
x |
A quantreg model object |
file |
Name of the file to export the table |
type |
Format of the file |
digits |
Number of decimals |
digitspvals |
Number of decimals for p-values |
info |
If TRUE, include call in the exported table |
print |
Should the report table be printed on screen? |
... |
Further arguments passed to make_table |
Value
A data frame with the report table
Function to compute bootstrap confidence intervals for robust linear regression models
Description
Estimates confidence intervals for rlm models.
Usage
rob.ci(x, level = 0.95, maxit = 200, R = 2000)
Arguments
x |
A rlm object |
level |
Confidence level for the interval |
maxit |
Maximum number of iterations per fit |
R |
Number of boostrap samples |
Value
A matrix with bootstrap confidence intervals for each variable in the model
Function to compute p-values for robust linear regression models
Description
Estimates p-values for rlm models.
Usage
rob.pvals(x)
Arguments
x |
A rlm object |
Value
A vector of p-values
Set header names for word tables
Description
Internal function for make_word_table.
Usage
set_noms(x, args)
Arguments
x |
A flextable object |
args |
A names list with the header names |
Value
A flextable object with assigned header names