modifications to ui and using DT for tables

This commit is contained in:
Andreas Gammelgaard Damsbo 2024-11-28 21:02:23 +01:00
commit 15fe4ca188
No known key found for this signature in database
16 changed files with 567 additions and 128 deletions

View file

@ -1,14 +0,0 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/app.R
\name{panel_space}
\alias{panel_space}
\title{Wrapping nav_spacer to avoid errors on dependencies when packaging}
\usage{
panel_space()
}
\value{
bslib object
}
\description{
Wrapping nav_spacer to avoid errors on dependencies when packaging
}

View file

@ -2,7 +2,7 @@
% Please edit documentation in R/regression_model.R
\name{regression_model}
\alias{regression_model}
\title{Print a flexible baseline characteristics table}
\title{Create a regression model programatically}
\usage{
regression_model(
data,
@ -11,7 +11,8 @@ regression_model(
formula.str = NULL,
args.list = NULL,
fun = NULL,
vars = NULL
vars = NULL,
...
)
}
\arguments{
@ -28,12 +29,14 @@ regression_model(
\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{
Print a flexible baseline characteristics table
Create a regression model programatically
}
\examples{
gtsummary::trial |>

View file

@ -0,0 +1,51 @@
% 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"))
)
}
}

View file

@ -2,12 +2,20 @@
% Please edit documentation in R/regression_table.R
\name{regression_table}
\alias{regression_table}
\alias{regression_table.list}
\alias{regression_table.webresearch_model}
\title{Create table of regression model}
\usage{
regression_table(data, args.list = NULL, fun = "gtsummary::tbl_regression")
regression_table(x, ...)
\method{regression_table}{list}(x, ...)
\method{regression_table}{webresearch_model}(x, ..., args.list = NULL, fun = "gtsummary::tbl_regression")
}
\arguments{
\item{data}{regression model}
\item{x}{regression model}
\item{...}{passed to methods}
\item{args.list}{list of arguments passed to 'fun'.}
@ -20,6 +28,7 @@ object of standard class for fun
Create table of regression model
}
\examples{
\dontrun{
gtsummary::trial |>
regression_model(
outcome.str = "stage",
@ -41,4 +50,34 @@ gtsummary::trial |>
args.list = list(family = binomial(link = "logit"))
) |>
regression_table()
gtsummary::trial |>
regression_model_uv(
outcome.str = "trt",
fun = "stats::glm",
args.list = list(family = stats::binomial(link = "logit"))
) |>
regression_table()
gtsummary::trial |>
regression_model_uv(
outcome.str = "stage",
args.list = list(family = stats::binomial(link = "logit"))
) |>
regression_table()
list(
"Univariable" = regression_model_uv,
"Multivariable" = regression_model
) |>
lapply(\(.fun){
do.call(
.fun,
c(
list(data = gtsummary::trial),
list(outcome.str = "stage")
)
)
}) |>
purrr::map(regression_table) |>
tbl_merge()
}
}

View file

@ -1,5 +1,5 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/app.R
% Please edit documentation in R/shiny_webResearch.R
\name{shiny_webResearch}
\alias{shiny_webResearch}
\title{Test version of the shiny_cast function to launch the app with a data set in

19
man/tbl_merge.Rd Normal file
View file

@ -0,0 +1,19 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/regression_table.R
\name{tbl_merge}
\alias{tbl_merge}
\title{A substitue to gtsummary::tbl_merge, that will use list names for the tab
spanner names.}
\usage{
tbl_merge(data)
}
\arguments{
\item{data}{gtsummary list object}
}
\value{
gt summary list object
}
\description{
A substitue to gtsummary::tbl_merge, that will use list names for the tab
spanner names.
}