mirror of
https://github.com/agdamsbo/FreesearchR.git
synced 2025-09-12 18:09:39 +02:00
abandoned the methods approach for a more simpler conditional parsing as the S3 methods resulted in an error
This commit is contained in:
parent
9ca7698200
commit
a2f3aa5481
2 changed files with 34 additions and 8 deletions
|
@ -1,13 +1,13 @@
|
||||||
# Generated by roxygen2: do not edit by hand
|
# Generated by roxygen2: do not edit by hand
|
||||||
|
|
||||||
S3method(cut,hms)
|
S3method(cut,hms)
|
||||||
S3method(regression_table,default)
|
|
||||||
S3method(regression_table,list)
|
|
||||||
export(argsstring2list)
|
export(argsstring2list)
|
||||||
export(baseline_table)
|
export(baseline_table)
|
||||||
|
export(custom_theme)
|
||||||
export(cut_variable_server)
|
export(cut_variable_server)
|
||||||
export(cut_variable_ui)
|
export(cut_variable_ui)
|
||||||
export(default_format_arguments)
|
export(default_format_arguments)
|
||||||
|
export(default_parsing)
|
||||||
export(factorize)
|
export(factorize)
|
||||||
export(format_writer)
|
export(format_writer)
|
||||||
export(getfun)
|
export(getfun)
|
||||||
|
|
|
@ -2,15 +2,9 @@
|
||||||
% Please edit documentation in R/regression_table.R
|
% Please edit documentation in R/regression_table.R
|
||||||
\name{regression_table}
|
\name{regression_table}
|
||||||
\alias{regression_table}
|
\alias{regression_table}
|
||||||
\alias{regression_table.list}
|
|
||||||
\alias{regression_table.default}
|
|
||||||
\title{Create table of regression model}
|
\title{Create table of regression model}
|
||||||
\usage{
|
\usage{
|
||||||
regression_table(x, ...)
|
regression_table(x, ...)
|
||||||
|
|
||||||
\method{regression_table}{list}(x, ...)
|
|
||||||
|
|
||||||
\method{regression_table}{default}(x, ..., args.list = NULL, fun = "gtsummary::tbl_regression")
|
|
||||||
}
|
}
|
||||||
\arguments{
|
\arguments{
|
||||||
\item{x}{regression model}
|
\item{x}{regression model}
|
||||||
|
@ -80,4 +74,36 @@ list(
|
||||||
purrr::map(regression_table) |>
|
purrr::map(regression_table) |>
|
||||||
tbl_merge()
|
tbl_merge()
|
||||||
}
|
}
|
||||||
|
regression_table <- function(x, ...) {
|
||||||
|
UseMethod("regression_table")
|
||||||
|
}
|
||||||
|
|
||||||
|
#' @rdname regression_table
|
||||||
|
#' @export
|
||||||
|
regression_table.list <- function(x, ...) {
|
||||||
|
x |>
|
||||||
|
purrr::map(\(.m){
|
||||||
|
regression_table(x = .m, ...) |>
|
||||||
|
gtsummary::add_n()
|
||||||
|
}) |>
|
||||||
|
gtsummary::tbl_stack()
|
||||||
|
}
|
||||||
|
|
||||||
|
#' @rdname regression_table
|
||||||
|
#' @export
|
||||||
|
regression_table.default <- function(x, ..., args.list = NULL, fun = "gtsummary::tbl_regression") {
|
||||||
|
# Stripping custom class
|
||||||
|
class(x) <- class(x)[class(x) != "webresearch_model"]
|
||||||
|
|
||||||
|
if (any(c(length(class(x)) != 1, class(x) != "lm"))) {
|
||||||
|
if (!"exponentiate" \%in\% names(args.list)) {
|
||||||
|
args.list <- c(args.list, list(exponentiate = TRUE))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
out <- do.call(getfun(fun), c(list(x = x), args.list))
|
||||||
|
out |>
|
||||||
|
gtsummary::add_glance_source_note() # |>
|
||||||
|
# gtsummary::bold_p()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue