mirror of
https://github.com/agdamsbo/FreesearchR.git
synced 2025-09-12 01:49:39 +02:00
updated docs
This commit is contained in:
parent
c2b4b34215
commit
c4b5a7ba79
21 changed files with 444 additions and 80 deletions
16
NAMESPACE
16
NAMESPACE
|
@ -1,14 +1,19 @@
|
||||||
# Generated by roxygen2: do not edit by hand
|
# Generated by roxygen2: do not edit by hand
|
||||||
|
|
||||||
S3method(cut,hms)
|
S3method(cut,hms)
|
||||||
|
S3method(plot,tbl_regression)
|
||||||
export(add_class_icon)
|
export(add_class_icon)
|
||||||
export(add_sparkline)
|
export(add_sparkline)
|
||||||
export(argsstring2list)
|
export(argsstring2list)
|
||||||
export(baseline_table)
|
export(baseline_table)
|
||||||
|
export(clean_date)
|
||||||
|
export(clean_sep)
|
||||||
export(create_overview_datagrid)
|
export(create_overview_datagrid)
|
||||||
export(custom_theme)
|
export(custom_theme)
|
||||||
export(cut_variable_server)
|
export(cut_variable_server)
|
||||||
export(cut_variable_ui)
|
export(cut_variable_ui)
|
||||||
|
export(data_correlations_server)
|
||||||
|
export(data_correlations_ui)
|
||||||
export(data_summary_server)
|
export(data_summary_server)
|
||||||
export(data_summary_ui)
|
export(data_summary_ui)
|
||||||
export(default_format_arguments)
|
export(default_format_arguments)
|
||||||
|
@ -16,24 +21,35 @@ export(default_parsing)
|
||||||
export(factorize)
|
export(factorize)
|
||||||
export(file_export)
|
export(file_export)
|
||||||
export(format_writer)
|
export(format_writer)
|
||||||
|
export(get_fun_options)
|
||||||
export(getfun)
|
export(getfun)
|
||||||
|
export(gg_theme_export)
|
||||||
|
export(gg_theme_shiny)
|
||||||
export(index_embed)
|
export(index_embed)
|
||||||
export(is_any_class)
|
export(is_any_class)
|
||||||
export(is_consecutive)
|
export(is_consecutive)
|
||||||
export(is_datetime)
|
export(is_datetime)
|
||||||
|
export(launch)
|
||||||
export(m_datafileUI)
|
export(m_datafileUI)
|
||||||
export(m_redcap_readServer)
|
export(m_redcap_readServer)
|
||||||
export(m_redcap_readUI)
|
export(m_redcap_readUI)
|
||||||
|
export(merge_long)
|
||||||
export(modal_cut_variable)
|
export(modal_cut_variable)
|
||||||
export(modify_qmd)
|
export(modify_qmd)
|
||||||
|
export(outcome_type)
|
||||||
export(overview_vars)
|
export(overview_vars)
|
||||||
|
export(possible_functions)
|
||||||
export(read_input)
|
export(read_input)
|
||||||
export(regression_model)
|
export(regression_model)
|
||||||
|
export(regression_model_list)
|
||||||
export(regression_model_uv)
|
export(regression_model_uv)
|
||||||
|
export(regression_model_uv_list)
|
||||||
export(regression_table)
|
export(regression_table)
|
||||||
|
export(remove_empty_cols)
|
||||||
export(remove_na_attr)
|
export(remove_na_attr)
|
||||||
export(shiny_freesearcheR)
|
export(shiny_freesearcheR)
|
||||||
export(specify_qmd_format)
|
export(specify_qmd_format)
|
||||||
|
export(supported_functions)
|
||||||
export(tbl_merge)
|
export(tbl_merge)
|
||||||
export(update_variables_server)
|
export(update_variables_server)
|
||||||
export(update_variables_ui)
|
export(update_variables_ui)
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#' @returns Shiny ui module
|
#' @returns Shiny ui module
|
||||||
#' @export
|
#' @export
|
||||||
data_correlations_ui <- function(id, ...) {
|
data_correlations_ui <- function(id, ...) {
|
||||||
ns <- NS(id)
|
ns <- shiny::NS(id)
|
||||||
|
|
||||||
shiny::tagList(
|
shiny::tagList(
|
||||||
shiny::textOutput(outputId = ns("suggest")),
|
shiny::textOutput(outputId = ns("suggest")),
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#'
|
#'
|
||||||
#' @return object of standard class for fun
|
#' @return object of standard class for fun
|
||||||
#' @export
|
#' @export
|
||||||
|
#' @rdname regression_model
|
||||||
#'
|
#'
|
||||||
#' @examples
|
#' @examples
|
||||||
#' gtsummary::trial |>
|
#' gtsummary::trial |>
|
||||||
|
@ -149,6 +150,7 @@ regression_model <- function(data,
|
||||||
#' @param ... ignored for now
|
#' @param ... ignored for now
|
||||||
#'
|
#'
|
||||||
#' @importFrom stats as.formula
|
#' @importFrom stats as.formula
|
||||||
|
#' @rdname regression_model
|
||||||
#'
|
#'
|
||||||
#' @return object of standard class for fun
|
#' @return object of standard class for fun
|
||||||
#' @export
|
#' @export
|
||||||
|
@ -323,7 +325,7 @@ supported_functions <- function() {
|
||||||
#'
|
#'
|
||||||
#' @param data data
|
#' @param data data
|
||||||
#'
|
#'
|
||||||
#' @returns
|
#' @returns character vector
|
||||||
#' @export
|
#' @export
|
||||||
#'
|
#'
|
||||||
#' @examples
|
#' @examples
|
||||||
|
@ -412,8 +414,9 @@ get_fun_options <- function(data) {
|
||||||
#' argsstring2list() or list of arguments. Default is NULL.
|
#' argsstring2list() or list of arguments. Default is NULL.
|
||||||
#' @param ... ignored
|
#' @param ... ignored
|
||||||
#'
|
#'
|
||||||
#' @returns
|
#' @returns list
|
||||||
#' @export
|
#' @export
|
||||||
|
#' @rdname regression_model
|
||||||
#'
|
#'
|
||||||
#' @examples
|
#' @examples
|
||||||
#' \dontrun{
|
#' \dontrun{
|
||||||
|
@ -528,19 +531,9 @@ list2str <- function(data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#' Title
|
|
||||||
#'
|
|
||||||
#' @param data
|
|
||||||
#' @param outcome.str
|
|
||||||
#' @param fun.descr
|
|
||||||
#' @param fun
|
|
||||||
#' @param formula.str
|
|
||||||
#' @param args.list
|
|
||||||
#' @param vars
|
|
||||||
#' @param ...
|
|
||||||
#'
|
|
||||||
#' @returns list
|
#' @returns list
|
||||||
#' @export
|
#' @export
|
||||||
|
#' @rdname regression_model
|
||||||
#'
|
#'
|
||||||
#' @examples
|
#' @examples
|
||||||
#' \dontrun{
|
#' \dontrun{
|
||||||
|
|
|
@ -23,3 +23,15 @@ shiny_freesearcheR <- function(...) {
|
||||||
a <- shiny::runApp(appDir = paste0(appDir,"/app.R"), ...)
|
a <- shiny::runApp(appDir = paste0(appDir,"/app.R"), ...)
|
||||||
return(invisible(a))
|
return(invisible(a))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#' Easily launch the freesearcheR app
|
||||||
|
#'
|
||||||
|
#' @param ... passed on to `shiny::runApp()`
|
||||||
|
#'
|
||||||
|
#' @returns shiny app
|
||||||
|
#' @export
|
||||||
|
#'
|
||||||
|
launch <- function(...){
|
||||||
|
shiny_freesearcheR(...)
|
||||||
|
}
|
||||||
|
|
17
man/clean_date.Rd
Normal file
17
man/clean_date.Rd
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
% Generated by roxygen2: do not edit by hand
|
||||||
|
% Please edit documentation in R/update-variables-ext.R
|
||||||
|
\name{clean_date}
|
||||||
|
\alias{clean_date}
|
||||||
|
\title{Attempts at applying uniform date format}
|
||||||
|
\usage{
|
||||||
|
clean_date(data)
|
||||||
|
}
|
||||||
|
\arguments{
|
||||||
|
\item{data}{character string vector of possible dates}
|
||||||
|
}
|
||||||
|
\value{
|
||||||
|
character string
|
||||||
|
}
|
||||||
|
\description{
|
||||||
|
Attempts at applying uniform date format
|
||||||
|
}
|
21
man/clean_sep.Rd
Normal file
21
man/clean_sep.Rd
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
% Generated by roxygen2: do not edit by hand
|
||||||
|
% Please edit documentation in R/update-variables-ext.R
|
||||||
|
\name{clean_sep}
|
||||||
|
\alias{clean_sep}
|
||||||
|
\title{gsub wrapper for piping with default values for separator substituting}
|
||||||
|
\usage{
|
||||||
|
clean_sep(data, old.sep = "[-.,/]", new.sep = "-")
|
||||||
|
}
|
||||||
|
\arguments{
|
||||||
|
\item{data}{character vector}
|
||||||
|
|
||||||
|
\item{old.sep}{old separator}
|
||||||
|
|
||||||
|
\item{new.sep}{new separator}
|
||||||
|
}
|
||||||
|
\value{
|
||||||
|
character vector
|
||||||
|
}
|
||||||
|
\description{
|
||||||
|
gsub wrapper for piping with default values for separator substituting
|
||||||
|
}
|
31
man/data-correlations.Rd
Normal file
31
man/data-correlations.Rd
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
% Generated by roxygen2: do not edit by hand
|
||||||
|
% Please edit documentation in R/correlations-module.R
|
||||||
|
\name{data-correlations}
|
||||||
|
\alias{data-correlations}
|
||||||
|
\alias{data_correlations_ui}
|
||||||
|
\alias{data_correlations_server}
|
||||||
|
\title{Data correlations evaluation module}
|
||||||
|
\usage{
|
||||||
|
data_correlations_ui(id, ...)
|
||||||
|
|
||||||
|
data_correlations_server(id, data, include.class = NULL, cutoff = 0.7, ...)
|
||||||
|
}
|
||||||
|
\arguments{
|
||||||
|
\item{id}{Module id. (Use 'ns("id")')}
|
||||||
|
|
||||||
|
\item{...}{arguments passed to toastui::datagrid}
|
||||||
|
|
||||||
|
\item{data}{data}
|
||||||
|
|
||||||
|
\item{color.main}{main color}
|
||||||
|
|
||||||
|
\item{color.sec}{secondary color}
|
||||||
|
}
|
||||||
|
\value{
|
||||||
|
Shiny ui module
|
||||||
|
|
||||||
|
shiny server module
|
||||||
|
}
|
||||||
|
\description{
|
||||||
|
Data correlations evaluation module
|
||||||
|
}
|
|
@ -8,16 +8,18 @@
|
||||||
\usage{
|
\usage{
|
||||||
data_summary_ui(id)
|
data_summary_ui(id)
|
||||||
|
|
||||||
data_summary_server(id, data, color.main, color.sec)
|
data_summary_server(id, data, color.main, color.sec, ...)
|
||||||
}
|
}
|
||||||
\arguments{
|
\arguments{
|
||||||
\item{id}{id}
|
\item{id}{Module id. (Use 'ns("id")')}
|
||||||
|
|
||||||
\item{data}{data}
|
\item{data}{data}
|
||||||
|
|
||||||
\item{color.main}{main color}
|
\item{color.main}{main color}
|
||||||
|
|
||||||
\item{color.sec}{secondary color}
|
\item{color.sec}{secondary color}
|
||||||
|
|
||||||
|
\item{...}{arguments passed to toastui::datagrid}
|
||||||
}
|
}
|
||||||
\value{
|
\value{
|
||||||
Shiny ui module
|
Shiny ui module
|
||||||
|
|
27
man/get_fun_options.Rd
Normal file
27
man/get_fun_options.Rd
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
% Generated by roxygen2: do not edit by hand
|
||||||
|
% Please edit documentation in R/regression_model.R
|
||||||
|
\name{get_fun_options}
|
||||||
|
\alias{get_fun_options}
|
||||||
|
\title{Get the function options based on the selected function description}
|
||||||
|
\usage{
|
||||||
|
get_fun_options(data)
|
||||||
|
}
|
||||||
|
\arguments{
|
||||||
|
\item{data}{vector}
|
||||||
|
}
|
||||||
|
\value{
|
||||||
|
list
|
||||||
|
}
|
||||||
|
\description{
|
||||||
|
Get the function options based on the selected function description
|
||||||
|
}
|
||||||
|
\examples{
|
||||||
|
mtcars |>
|
||||||
|
default_parsing() |>
|
||||||
|
dplyr::pull(mpg) |>
|
||||||
|
possible_functions(design = "cross-sectional") |>
|
||||||
|
(\(.x){
|
||||||
|
.x[[1]]
|
||||||
|
})() |>
|
||||||
|
get_fun_options()
|
||||||
|
}
|
17
man/gg_theme_export.Rd
Normal file
17
man/gg_theme_export.Rd
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
% Generated by roxygen2: do not edit by hand
|
||||||
|
% Please edit documentation in R/theme.R
|
||||||
|
\name{gg_theme_export}
|
||||||
|
\alias{gg_theme_export}
|
||||||
|
\title{GGplot default theme for plotting export objects}
|
||||||
|
\usage{
|
||||||
|
gg_theme_export()
|
||||||
|
}
|
||||||
|
\arguments{
|
||||||
|
\item{data}{ggplot object}
|
||||||
|
}
|
||||||
|
\value{
|
||||||
|
ggplot object
|
||||||
|
}
|
||||||
|
\description{
|
||||||
|
GGplot default theme for plotting export objects
|
||||||
|
}
|
17
man/gg_theme_shiny.Rd
Normal file
17
man/gg_theme_shiny.Rd
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
% Generated by roxygen2: do not edit by hand
|
||||||
|
% Please edit documentation in R/theme.R
|
||||||
|
\name{gg_theme_shiny}
|
||||||
|
\alias{gg_theme_shiny}
|
||||||
|
\title{GGplot default theme for plotting in Shiny}
|
||||||
|
\usage{
|
||||||
|
gg_theme_shiny()
|
||||||
|
}
|
||||||
|
\arguments{
|
||||||
|
\item{data}{ggplot object}
|
||||||
|
}
|
||||||
|
\value{
|
||||||
|
ggplot object
|
||||||
|
}
|
||||||
|
\description{
|
||||||
|
GGplot default theme for plotting in Shiny
|
||||||
|
}
|
17
man/launch.Rd
Normal file
17
man/launch.Rd
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
% Generated by roxygen2: do not edit by hand
|
||||||
|
% Please edit documentation in R/shiny_freesearcheR.R
|
||||||
|
\name{launch}
|
||||||
|
\alias{launch}
|
||||||
|
\title{Easily launch the freesearcheR app}
|
||||||
|
\usage{
|
||||||
|
launch(...)
|
||||||
|
}
|
||||||
|
\arguments{
|
||||||
|
\item{...}{passed on to \code{shiny::runApp()}}
|
||||||
|
}
|
||||||
|
\value{
|
||||||
|
shiny app
|
||||||
|
}
|
||||||
|
\description{
|
||||||
|
Easily launch the freesearcheR app
|
||||||
|
}
|
19
man/merge_long.Rd
Normal file
19
man/merge_long.Rd
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
% Generated by roxygen2: do not edit by hand
|
||||||
|
% Please edit documentation in R/regression_plot.R
|
||||||
|
\name{merge_long}
|
||||||
|
\alias{merge_long}
|
||||||
|
\title{Wrapper to pivot gtsummary table data to long for plotting}
|
||||||
|
\usage{
|
||||||
|
merge_long(list, model.names)
|
||||||
|
}
|
||||||
|
\arguments{
|
||||||
|
\item{list}{a custom regression models list}
|
||||||
|
|
||||||
|
\item{model.names}{names of models to include}
|
||||||
|
}
|
||||||
|
\value{
|
||||||
|
list
|
||||||
|
}
|
||||||
|
\description{
|
||||||
|
Wrapper to pivot gtsummary table data to long for plotting
|
||||||
|
}
|
22
man/outcome_type.Rd
Normal file
22
man/outcome_type.Rd
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
% Generated by roxygen2: do not edit by hand
|
||||||
|
% Please edit documentation in R/regression_model.R
|
||||||
|
\name{outcome_type}
|
||||||
|
\alias{outcome_type}
|
||||||
|
\title{Outcome data type assessment}
|
||||||
|
\usage{
|
||||||
|
outcome_type(data)
|
||||||
|
}
|
||||||
|
\arguments{
|
||||||
|
\item{data}{data}
|
||||||
|
}
|
||||||
|
\value{
|
||||||
|
outcome type
|
||||||
|
}
|
||||||
|
\description{
|
||||||
|
Outcome data type assessment
|
||||||
|
}
|
||||||
|
\examples{
|
||||||
|
mtcars |>
|
||||||
|
default_parsing() |>
|
||||||
|
lapply(outcome_type)
|
||||||
|
}
|
29
man/plot.tbl_regression.Rd
Normal file
29
man/plot.tbl_regression.Rd
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
% Generated by roxygen2: do not edit by hand
|
||||||
|
% Please edit documentation in R/regression_plot.R
|
||||||
|
\name{plot.tbl_regression}
|
||||||
|
\alias{plot.tbl_regression}
|
||||||
|
\title{Regression coef plot from gtsummary. Slightly modified to pass on arguments}
|
||||||
|
\usage{
|
||||||
|
\method{plot}{tbl_regression}(x, ...)
|
||||||
|
}
|
||||||
|
\arguments{
|
||||||
|
\item{x}{(\code{tbl_regression}, \code{tbl_uvregression})\cr
|
||||||
|
A 'tbl_regression' or 'tbl_uvregression' object}
|
||||||
|
|
||||||
|
\item{...}{arguments passed to \code{ggstats::ggcoef_plot(...)}}
|
||||||
|
}
|
||||||
|
\value{
|
||||||
|
ggplot object
|
||||||
|
}
|
||||||
|
\description{
|
||||||
|
Regression coef plot from gtsummary. Slightly modified to pass on arguments
|
||||||
|
}
|
||||||
|
\examples{
|
||||||
|
\dontrun{
|
||||||
|
mod <- lm(mpg ~ ., mtcars)
|
||||||
|
p <- mod |>
|
||||||
|
gtsummary::tbl_regression() |>
|
||||||
|
plot(colour = "variable")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
28
man/possible_functions.Rd
Normal file
28
man/possible_functions.Rd
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
% Generated by roxygen2: do not edit by hand
|
||||||
|
% Please edit documentation in R/regression_model.R
|
||||||
|
\name{possible_functions}
|
||||||
|
\alias{possible_functions}
|
||||||
|
\title{Get possible regression models}
|
||||||
|
\usage{
|
||||||
|
possible_functions(data, design = c("cross-sectional"))
|
||||||
|
}
|
||||||
|
\arguments{
|
||||||
|
\item{data}{data}
|
||||||
|
}
|
||||||
|
\value{
|
||||||
|
character vector
|
||||||
|
}
|
||||||
|
\description{
|
||||||
|
Get possible regression models
|
||||||
|
}
|
||||||
|
\examples{
|
||||||
|
mtcars |>
|
||||||
|
default_parsing() |>
|
||||||
|
dplyr::pull("cyl") |>
|
||||||
|
possible_functions(design = "cross-sectional")
|
||||||
|
|
||||||
|
mtcars |>
|
||||||
|
default_parsing() |>
|
||||||
|
dplyr::select("cyl") |>
|
||||||
|
possible_functions(design = "cross-sectional")
|
||||||
|
}
|
|
@ -2,41 +2,85 @@
|
||||||
% Please edit documentation in R/regression_model.R
|
% Please edit documentation in R/regression_model.R
|
||||||
\name{regression_model}
|
\name{regression_model}
|
||||||
\alias{regression_model}
|
\alias{regression_model}
|
||||||
|
\alias{regression_model_uv}
|
||||||
|
\alias{regression_model_list}
|
||||||
|
\alias{regression_model_uv_list}
|
||||||
\title{Create a regression model programatically}
|
\title{Create a regression model programatically}
|
||||||
\usage{
|
\usage{
|
||||||
regression_model(
|
regression_model(
|
||||||
data,
|
data,
|
||||||
outcome.str,
|
outcome.str,
|
||||||
auto.mode = TRUE,
|
auto.mode = FALSE,
|
||||||
formula.str = NULL,
|
formula.str = NULL,
|
||||||
args.list = NULL,
|
args.list = NULL,
|
||||||
fun = NULL,
|
fun = NULL,
|
||||||
vars = NULL,
|
vars = NULL,
|
||||||
...
|
...
|
||||||
)
|
)
|
||||||
|
|
||||||
|
regression_model_uv(
|
||||||
|
data,
|
||||||
|
outcome.str,
|
||||||
|
args.list = NULL,
|
||||||
|
fun = NULL,
|
||||||
|
vars = NULL,
|
||||||
|
...
|
||||||
|
)
|
||||||
|
|
||||||
|
regression_model_list(
|
||||||
|
data,
|
||||||
|
outcome.str,
|
||||||
|
fun.descr,
|
||||||
|
fun = NULL,
|
||||||
|
formula.str = NULL,
|
||||||
|
args.list = NULL,
|
||||||
|
vars = NULL,
|
||||||
|
...
|
||||||
|
)
|
||||||
|
|
||||||
|
regression_model_uv_list(
|
||||||
|
data,
|
||||||
|
outcome.str,
|
||||||
|
fun.descr,
|
||||||
|
fun = NULL,
|
||||||
|
formula.str = NULL,
|
||||||
|
args.list = NULL,
|
||||||
|
vars = NULL,
|
||||||
|
...
|
||||||
|
)
|
||||||
}
|
}
|
||||||
\arguments{
|
\arguments{
|
||||||
\item{data}{data set}
|
\item{data}{data}
|
||||||
|
|
||||||
\item{outcome.str}{Name of outcome variable. Character vector.}
|
\item{outcome.str}{name of outcome variable}
|
||||||
|
|
||||||
\item{auto.mode}{Make assumptions on function dependent on outcome data format. Overwrites other arguments.}
|
\item{auto.mode}{Make assumptions on function dependent on outcome data format. Overwrites other arguments.}
|
||||||
|
|
||||||
\item{formula.str}{Formula as string. Passed through 'glue::glue'. If given, 'outcome.str' and 'vars' are ignored. Optional.}
|
\item{formula.str}{custom formula glue string. Default is NULL.}
|
||||||
|
|
||||||
\item{args.list}{List of arguments passed to 'fun' with 'do.call'.}
|
\item{args.list}{custom character string to be converted using
|
||||||
|
argsstring2list() or list of arguments. Default is NULL.}
|
||||||
|
|
||||||
\item{fun}{Name of function as character vector or function to use for model creation.}
|
\item{fun}{name of custom function. Default is NULL.}
|
||||||
|
|
||||||
\item{vars}{character vector of variables to include}
|
\item{vars}{character vector of variables to include}
|
||||||
|
|
||||||
\item{...}{ignored for now}
|
\item{...}{ignored}
|
||||||
|
|
||||||
|
\item{fun.descr}{Description of chosen function matching description in
|
||||||
|
"supported_functions()"}
|
||||||
}
|
}
|
||||||
\value{
|
\value{
|
||||||
object of standard class for fun
|
object of standard class for fun
|
||||||
|
|
||||||
|
object of standard class for fun
|
||||||
|
|
||||||
|
list
|
||||||
|
|
||||||
|
list
|
||||||
}
|
}
|
||||||
\description{
|
\description{
|
||||||
Create a regression model programatically
|
Output is a concatenated list of model information and model
|
||||||
}
|
}
|
||||||
\examples{
|
\examples{
|
||||||
gtsummary::trial |>
|
gtsummary::trial |>
|
||||||
|
@ -49,10 +93,73 @@ gtsummary::trial |>
|
||||||
formula.str = "{outcome.str}~.",
|
formula.str = "{outcome.str}~.",
|
||||||
args.list = NULL
|
args.list = NULL
|
||||||
)
|
)
|
||||||
gtsummary::trial |> regression_model(
|
gtsummary::trial |>
|
||||||
|
default_parsing() |>
|
||||||
|
regression_model(
|
||||||
|
outcome.str = "trt",
|
||||||
|
auto.mode = FALSE,
|
||||||
|
fun = "stats::glm",
|
||||||
|
args.list = list(family = binomial(link = "logit"))
|
||||||
|
)
|
||||||
|
m <- mtcars |>
|
||||||
|
default_parsing() |>
|
||||||
|
regression_model(
|
||||||
|
outcome.str = "mpg",
|
||||||
|
auto.mode = FALSE,
|
||||||
|
fun = "stats::lm",
|
||||||
|
formula.str = "{outcome.str}~{paste(vars,collapse='+')}",
|
||||||
|
args.list = NULL,
|
||||||
|
vars = c("mpg", "cyl")
|
||||||
|
)
|
||||||
|
broom::tidy(m)
|
||||||
|
\dontrun{
|
||||||
|
gtsummary::trial |>
|
||||||
|
regression_model_uv(outcome.str = "age")
|
||||||
|
gtsummary::trial |>
|
||||||
|
regression_model_uv(
|
||||||
|
outcome.str = "age",
|
||||||
|
fun = "stats::lm",
|
||||||
|
args.list = NULL
|
||||||
|
)
|
||||||
|
m <- gtsummary::trial |> regression_model_uv(
|
||||||
outcome.str = "trt",
|
outcome.str = "trt",
|
||||||
auto.mode = FALSE,
|
|
||||||
fun = "stats::glm",
|
fun = "stats::glm",
|
||||||
args.list = list(family = binomial(link = "logit"))
|
args.list = list(family = stats::binomial(link = "logit"))
|
||||||
)
|
)
|
||||||
|
lapply(m,broom::tidy) |> dplyr::bind_rows()
|
||||||
|
}
|
||||||
|
\dontrun{
|
||||||
|
gtsummary::trial |>
|
||||||
|
regression_model(
|
||||||
|
outcome.str = "age",
|
||||||
|
fun = "stats::lm",
|
||||||
|
formula.str = "{outcome.str}~.",
|
||||||
|
args.list = NULL
|
||||||
|
)
|
||||||
|
ls <- regression_model_list(data = default_parsing(mtcars), outcome.str = "cyl", fun.descr = "Ordinal logistic regression model")
|
||||||
|
summary(ls$model)
|
||||||
|
|
||||||
|
ls <- regression_model_list(data = default_parsing(gtsummary::trial), outcome.str = "trt", fun.descr = "Logistic regression model")
|
||||||
|
tbl <- gtsummary::tbl_regression(ls$model, exponentiate = TRUE)
|
||||||
|
m <- gtsummary::trial |>
|
||||||
|
default_parsing() |>
|
||||||
|
regression_model(
|
||||||
|
outcome.str = "trt",
|
||||||
|
fun = "stats::glm",
|
||||||
|
formula.str = "{outcome.str}~.",
|
||||||
|
args.list = list(family = stats::binomial(link = "logit"))
|
||||||
|
)
|
||||||
|
tbl2 <- gtsummary::tbl_regression(m, exponentiate = TRUE)
|
||||||
|
broom::tidy(ls$model)
|
||||||
|
broom::tidy(m)
|
||||||
|
}
|
||||||
|
\dontrun{
|
||||||
|
gtsummary::trial |> regression_model_uv(
|
||||||
|
outcome.str = "trt",
|
||||||
|
fun = "stats::glm",
|
||||||
|
args.list = list(family = stats::binomial(link = "logit"))
|
||||||
|
) |> lapply(broom::tidy) |> dplyr::bind_rows()
|
||||||
|
ms <- regression_model_uv_list(data = default_parsing(mtcars), outcome.str = "mpg", fun.descr = "Linear regression model")
|
||||||
|
lapply(ms$model,broom::tidy) |> dplyr::bind_rows()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,51 +0,0 @@
|
||||||
% Generated by roxygen2: do not edit by hand
|
|
||||||
% Please edit documentation in R/regression_model.R
|
|
||||||
\name{regression_model_uv}
|
|
||||||
\alias{regression_model_uv}
|
|
||||||
\title{Create a regression model programatically}
|
|
||||||
\usage{
|
|
||||||
regression_model_uv(
|
|
||||||
data,
|
|
||||||
outcome.str,
|
|
||||||
args.list = NULL,
|
|
||||||
fun = NULL,
|
|
||||||
vars = NULL,
|
|
||||||
...
|
|
||||||
)
|
|
||||||
}
|
|
||||||
\arguments{
|
|
||||||
\item{data}{data set}
|
|
||||||
|
|
||||||
\item{outcome.str}{Name of outcome variable. Character vector.}
|
|
||||||
|
|
||||||
\item{args.list}{List of arguments passed to 'fun' with 'do.call'.}
|
|
||||||
|
|
||||||
\item{fun}{Name of function as character vector or function to use for model creation.}
|
|
||||||
|
|
||||||
\item{vars}{character vector of variables to include}
|
|
||||||
|
|
||||||
\item{...}{ignored for now}
|
|
||||||
}
|
|
||||||
\value{
|
|
||||||
object of standard class for fun
|
|
||||||
}
|
|
||||||
\description{
|
|
||||||
Create a regression model programatically
|
|
||||||
}
|
|
||||||
\examples{
|
|
||||||
\dontrun{
|
|
||||||
gtsummary::trial |>
|
|
||||||
regression_model_uv(outcome.str = "age")
|
|
||||||
gtsummary::trial |>
|
|
||||||
regression_model_uv(
|
|
||||||
outcome.str = "age",
|
|
||||||
fun = "stats::lm",
|
|
||||||
args.list = NULL
|
|
||||||
)
|
|
||||||
gtsummary::trial |> regression_model_uv(
|
|
||||||
outcome.str = "trt",
|
|
||||||
fun = "stats::glm",
|
|
||||||
args.list = list(family = stats::binomial(link = "logit"))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -23,7 +23,7 @@ Create table of regression model
|
||||||
}
|
}
|
||||||
\examples{
|
\examples{
|
||||||
\dontrun{
|
\dontrun{
|
||||||
gtsummary::trial |>
|
tbl <- gtsummary::trial |>
|
||||||
regression_model(
|
regression_model(
|
||||||
outcome.str = "stage",
|
outcome.str = "stage",
|
||||||
fun = "MASS::polr"
|
fun = "MASS::polr"
|
||||||
|
@ -36,7 +36,7 @@ gtsummary::trial |>
|
||||||
formula.str = "{outcome.str}~.",
|
formula.str = "{outcome.str}~.",
|
||||||
args.list = NULL
|
args.list = NULL
|
||||||
) |>
|
) |>
|
||||||
regression_table()
|
regression_table() |> plot()
|
||||||
gtsummary::trial |>
|
gtsummary::trial |>
|
||||||
regression_model(
|
regression_model(
|
||||||
outcome.str = "trt",
|
outcome.str = "trt",
|
||||||
|
|
22
man/remove_empty_cols.Rd
Normal file
22
man/remove_empty_cols.Rd
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
% Generated by roxygen2: do not edit by hand
|
||||||
|
% Please edit documentation in R/helpers.R
|
||||||
|
\name{remove_empty_cols}
|
||||||
|
\alias{remove_empty_cols}
|
||||||
|
\title{Removes columns with completenes below cutoff}
|
||||||
|
\usage{
|
||||||
|
remove_empty_cols(data, cutoff = 0.7)
|
||||||
|
}
|
||||||
|
\arguments{
|
||||||
|
\item{data}{data frame}
|
||||||
|
|
||||||
|
\item{cutoff}{numeric}
|
||||||
|
}
|
||||||
|
\value{
|
||||||
|
data frame
|
||||||
|
}
|
||||||
|
\description{
|
||||||
|
Removes columns with completenes below cutoff
|
||||||
|
}
|
||||||
|
\examples{
|
||||||
|
data.frame(a=1:10,b=NA, c=c(2,NA)) |> remove_empty_cols(cutoff=.5)
|
||||||
|
}
|
18
man/supported_functions.Rd
Normal file
18
man/supported_functions.Rd
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
% Generated by roxygen2: do not edit by hand
|
||||||
|
% Please edit documentation in R/regression_model.R
|
||||||
|
\name{supported_functions}
|
||||||
|
\alias{supported_functions}
|
||||||
|
\title{Implemented functions}
|
||||||
|
\usage{
|
||||||
|
supported_functions()
|
||||||
|
}
|
||||||
|
\value{
|
||||||
|
list
|
||||||
|
}
|
||||||
|
\description{
|
||||||
|
Library of supported functions. The list name and "descr" element should be
|
||||||
|
unique for each element on list.
|
||||||
|
}
|
||||||
|
\examples{
|
||||||
|
supported_functions()
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue