too much..

This commit is contained in:
Andreas Gammelgaard Damsbo 2025-03-05 21:13:06 +01:00
commit bc8aa7b583
No known key found for this signature in database
28 changed files with 1064 additions and 95 deletions

22
man/all_but.Rd Normal file
View file

@ -0,0 +1,22 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data_plots.R
\name{all_but}
\alias{all_but}
\title{Select all from vector but}
\usage{
all_but(data, ...)
}
\arguments{
\item{data}{vector}
\item{...}{exclude}
}
\value{
vector
}
\description{
Select all from vector but
}
\examples{
all_but(1:10, c(2, 3), 11, 5)
}

27
man/append_list.Rd Normal file
View file

@ -0,0 +1,27 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/helpers.R
\name{append_list}
\alias{append_list}
\title{Append list with named index}
\usage{
append_list(data, list, index)
}
\arguments{
\item{data}{data to add to list}
\item{list}{list}
\item{index}{index name}
}
\value{
list
}
\description{
Append list with named index
}
\examples{
ls_d <- list(test=c(1:20))
ls_d <- list()
data.frame(letters[1:20],1:20) |> append_list(ls_d,"letters")
letters[1:20]|> append_list(ls_d,"letters")
}

45
man/columnSelectInput.Rd Normal file
View file

@ -0,0 +1,45 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/columnSelectInput.R
\name{columnSelectInput}
\alias{columnSelectInput}
\title{A selectizeInput customized for data frames with column labels}
\usage{
columnSelectInput(
inputId,
label,
data,
selected = "",
...,
col_subset = NULL,
placeholder = "",
onInitialize,
none_label = "No variable selected"
)
}
\arguments{
\item{inputId}{passed to \code{\link[shiny]{selectizeInput}}}
\item{label}{passed to \code{\link[shiny]{selectizeInput}}}
\item{data}{\code{data.frame} object from which fields should be populated}
\item{selected}{default selection}
\item{...}{passed to \code{\link[shiny]{selectizeInput}}}
\item{col_subset}{a \code{vector} containing the list of allowable columns to select}
\item{placeholder}{passed to \code{\link[shiny]{selectizeInput}} options}
\item{onInitialize}{passed to \code{\link[shiny]{selectizeInput}} options}
\item{none_label}{label for "none" item}
}
\value{
a \code{\link[shiny]{selectizeInput}} dropdown element
}
\description{
Copied and modified from the IDEAFilter package
Adds the option to select "none" which is handled later
}
\keyword{internal}

52
man/contrast_text.Rd Normal file
View file

@ -0,0 +1,52 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/contrast_text.R
\name{contrast_text}
\alias{contrast_text}
\title{Contrast Text Color}
\usage{
contrast_text(
background,
light_text = "white",
dark_text = "black",
threshold = 0.5,
method = "perceived_2",
...
)
}
\arguments{
\item{background}{A hex/named color value that represents the background.}
\item{light_text}{A hex/named color value that represents the light text
color.}
\item{dark_text}{A hex/named color value that represents the dark text color.}
\item{threshold}{A numeric value between 0 and 1 that is used to determine
the luminance threshold of the background color for text color.}
\item{method}{A character string that specifies the method for calculating
the luminance. Three different methods are available:
c("relative","perceived","perceived_2")}
\item{...}{parameter overflow. Ignored.}
}
\value{
A character string that contains the best contrast text color.
}
\description{
Calculates the best contrast text color for a given
background color.
}
\details{
This function aids in deciding the font color to print on a given background.
The function is based on the example provided by teppo:
https://stackoverflow.com/a/66669838/21019325.
The different methods provided are based on the methods outlined in the
StackOverflow thread:
https://stackoverflow.com/questions/596216/formula-to-determine-perceived-brightness-of-rgb-color
}
\examples{
contrast_text(c("#F2F2F2", "blue"))
contrast_text(c("#F2F2F2", "blue"), method="relative")
}

View file

@ -1,19 +1,25 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/correlations-module.R
% Please edit documentation in R/correlations-module.R, R/data_plots.R
\name{data-correlations}
\alias{data-correlations}
\alias{data_correlations_ui}
\alias{data_correlations_server}
\alias{data_visuals_ui}
\alias{data_visuals_server}
\title{Data correlations evaluation module}
\usage{
data_correlations_ui(id, ...)
data_correlations_server(id, data, include.class = NULL, cutoff = 0.7, ...)
data_visuals_ui(id, tab_title = "Plots", ...)
data_visuals_server(id, data, ...)
}
\arguments{
\item{id}{Module id. (Use 'ns("id")')}
\item{...}{arguments passed to toastui::datagrid}
\item{...}{ignored}
\item{data}{data}
@ -24,8 +30,14 @@ data_correlations_server(id, data, include.class = NULL, cutoff = 0.7, ...)
\value{
Shiny ui module
shiny server module
Shiny ui module
shiny server module
}
\description{
Data correlations evaluation module
Data correlations evaluation module
}

70
man/data-plots.Rd Normal file
View file

@ -0,0 +1,70 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data_plots.R
\name{data-plots}
\alias{data-plots}
\alias{plot_ridge}
\alias{create_plot}
\alias{plot_hbars}
\alias{plot_violin}
\alias{plot_scatter}
\alias{plot_sankey}
\title{Title}
\usage{
plot_ridge(data, x, y, z = NULL, ...)
create_plot(data, type, x, y, z = NULL, ...)
plot_hbars(data, x, y, z = NULL)
plot_violin(data, x, y, z = NULL)
plot_scatter(data, x, y, z = NULL)
plot_sankey(data, x, y, z = NULL, color.group = "x", colors = NULL)
}
\arguments{
\item{...}{ignored for now}
\item{type}{plot type (derived from possible_plots() and matches custom function)}
}
\value{
ggplot2 object
ggplot2 object
ggplot2 object
ggplot2 object
ggplot2 object
ggplot2 object
}
\description{
Title
Wrapper to create plot based on provided type
Nice horizontal stacked bars (Grotta bars)
Beatiful violin plot
Beautiful violin plot
Beautiful sankey plot with option to split by a tertiary group
}
\examples{
mtcars |>
default_parsing() |>
plot_ridge(x = "mpg", y = "cyl")
mtcars |> plot_ridge(x = "mpg", y = "cyl", z = "gear")
create_plot(mtcars, "plot_violin", "mpg", "cyl")
mtcars |> plot_hbars(x = "carb", y = "cyl")
mtcars |> plot_hbars(x = "carb", y = NULL)
mtcars |> plot_violin(x = "mpg", y = "cyl", z = "gear")
mtcars |> plot_scatter(x = "mpg", y = "wt")
ds <- data.frame(g = sample(LETTERS[1:2], 100, TRUE), first = REDCapCAST::as_factor(sample(letters[1:4], 100, TRUE)), last = REDCapCAST::as_factor(sample(letters[1:4], 100, TRUE)))
ds |> plot_sankey("first", "last")
ds |> plot_sankey("first", "last", color.group = "y")
ds |> plot_sankey("first", "last", z = "g", color.group = "y")
}

24
man/get_label.Rd Normal file
View file

@ -0,0 +1,24 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data_plots.R
\name{get_label}
\alias{get_label}
\title{Print label, and if missing print variable name}
\usage{
get_label(data, var = NULL)
}
\arguments{
\item{data}{vector or data frame}
}
\value{
character string
}
\description{
Print label, and if missing print variable name
}
\examples{
mtcars |> get_label(var = "mpg")
mtcars |> get_label()
mtcars$mpg |> get_label()
gtsummary::trial |> get_label(var = "trt")
1:10 |> get_label()
}

27
man/get_plot_options.Rd Normal file
View file

@ -0,0 +1,27 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data_plots.R
\name{get_plot_options}
\alias{get_plot_options}
\title{Get the function options based on the selected function description}
\usage{
get_plot_options(data)
}
\arguments{
\item{data}{vector}
}
\value{
list
}
\description{
Get the function options based on the selected function description
}
\examples{
ls <- mtcars |>
default_parsing() |>
dplyr::pull(mpg) |>
possible_plots() |>
(\(.x){
.x[[1]]
})() |>
get_plot_options()
}

View file

@ -0,0 +1,22 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/redcap_read_shiny_module.R
\name{is_valid_redcap_url}
\alias{is_valid_redcap_url}
\title{Title}
\usage{
is_valid_redcap_url(url)
}
\arguments{
\item{url}{}
}
\description{
Title
}
\examples{
url <- c(
"www.example.com",
"http://example.com",
"https://redcap.your.inst/api/"
)
is_valid_redcap_url(url)
}

20
man/is_valid_token.Rd Normal file
View file

@ -0,0 +1,20 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/redcap_read_shiny_module.R
\name{is_valid_token}
\alias{is_valid_token}
\title{Validate REDCap token}
\usage{
is_valid_token(token, pattern_env = NULL, nchar = 32)
}
\arguments{
\item{token}{token}
\item{pattern_env}{pattern}
}
\description{
Validate REDCap token
}
\examples{
token <- paste(sample(c(1:9, LETTERS[1:6]), 32, TRUE), collapse = "")
is_valid_token(token)
}

View file

@ -1,10 +1,10 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/shiny_freesearcheR.R
\name{launch}
\alias{launch}
\name{launch_freesearcheR}
\alias{launch_freesearcheR}
\title{Easily launch the freesearcheR app}
\usage{
launch(...)
launch_freesearcheR(...)
}
\arguments{
\item{...}{passed on to \code{shiny::runApp()}}

14
man/line_break.Rd Normal file
View file

@ -0,0 +1,14 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data_plots.R
\name{line_break}
\alias{line_break}
\title{Line breaking at given number of characters for nicely plotting labels}
\usage{
line_break(data, lineLength = 20)
}
\arguments{
\item{lineLength}{}
}
\description{
Line breaking at given number of characters for nicely plotting labels
}

22
man/plot_sankey_single.Rd Normal file
View file

@ -0,0 +1,22 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data_plots.R
\name{plot_sankey_single}
\alias{plot_sankey_single}
\title{Beautiful sankey plot}
\usage{
plot_sankey_single(data, x, y, color.group = "x", colors = NULL)
}
\arguments{
\item{colors}{}
}
\value{
ggplot2 object
}
\description{
Beautiful sankey plot
}
\examples{
ds <- data.frame(g = sample(LETTERS[1:2], 100, TRUE), first = REDCapCAST::as_factor(sample(letters[1:4], 100, TRUE)), last = REDCapCAST::as_factor(sample(letters[1:4], 100, TRUE)))
ds |> plot_sankey_single("first", "last")
ds |> plot_sankey_single("first", "last", color.group = "y")
}

28
man/possible_plots.Rd Normal file
View file

@ -0,0 +1,28 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data_plots.R
\name{possible_plots}
\alias{possible_plots}
\title{Get possible regression models}
\usage{
possible_plots(data)
}
\arguments{
\item{data}{data}
}
\value{
character vector
}
\description{
Get possible regression models
}
\examples{
mtcars |>
default_parsing() |>
dplyr::pull("cyl") |>
possible_plots()
mtcars |>
default_parsing() |>
dplyr::select("mpg") |>
possible_plots()
}

View file

@ -1,30 +1,21 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/redcap_read_shiny_module.R
\docType{data}
\name{m_redcap_readUI}
\alias{m_redcap_readUI}
\alias{m_redcap_readServer}
\alias{tdm_redcap_read}
\alias{redcap_app}
\alias{redcap_demo_app}
\title{Shiny module to browser and export REDCap data}
\format{
An object of class \code{teal_data_module} of length 2.
}
\usage{
m_redcap_readUI(id, include_title = TRUE)
m_redcap_readServer(id, output.format = c("df", "teal", "list"))
m_redcap_readServer(id)
tdm_redcap_read
redcap_app()
redcap_demo_app()
}
\arguments{
\item{id}{Namespace id}
\item{include_title}{logical to include title}
\item{output.format}{data.frame ("df") or teal data object ("teal")}
}
\value{
shiny ui element
@ -34,13 +25,10 @@ shiny server module
\description{
Shiny module to browser and export REDCap data
REDCap import teal data module
Test app for the redcap_read_shiny_module
}
\examples{
\dontrun{
redcap_app()
redcap_demo_app()
}
}
\keyword{datasets}

19
man/sankey_ready.Rd Normal file
View file

@ -0,0 +1,19 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data_plots.R
\name{sankey_ready}
\alias{sankey_ready}
\title{Readying data for sankey plot}
\usage{
sankey_ready(data, x, y, z = NULL, numbers = "count")
}
\arguments{
\item{z}{}
}
\description{
Readying data for sankey plot
}
\examples{
ds <- data.frame(g = sample(LETTERS[1:2], 100, TRUE), first = REDCapCAST::as_factor(sample(letters[1:4], 100, TRUE)), last = sample(c(letters[1:4], NA), 100, TRUE, prob = c(rep(.23, 4), .08)))
ds |> sankey_ready("first", "last")
ds |> sankey_ready("first", "last", numbers = "percentage")
}

26
man/subset_types.Rd Normal file
View file

@ -0,0 +1,26 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data_plots.R
\name{subset_types}
\alias{subset_types}
\title{Easily subset by data type function}
\usage{
subset_types(data, types, type.fun = outcome_type)
}
\arguments{
\item{data}{data}
\item{types}{desired types}
\item{type.fun}{function to get type. Default is outcome_type}
}
\value{
vector
}
\description{
Easily subset by data type function
}
\examples{
default_parsing(mtcars) |> subset_types("ordinal")
default_parsing(mtcars) |> subset_types(c("dichotomous", "ordinal"))
#' default_parsing(mtcars) |> subset_types("factor",class)
}

25
man/supported_plots.Rd Normal file
View file

@ -0,0 +1,25 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data_plots.R
\name{supported_plots}
\alias{supported_plots}
\title{Implemented functions}
\usage{
supported_plots()
}
\value{
list
}
\description{
Library of supported functions. The list name and "descr" element should be
unique for each element on list.
\itemize{
\item descr: Plot description
\item primary.type: Primary variable data type (continuous, dichotomous or ordinal)
\item secondary.type: Secondary variable data type (continuous, dichotomous or ordinal)
\item secondary.extra: "none" or NULL to have option to choose none.
\item tertiary.type: Tertiary variable data type (continuous, dichotomous or ordinal)
}
}
\examples{
supported_plots() |> str()
}

48
man/update-factor.Rd Normal file
View file

@ -0,0 +1,48 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/update-factor-ext.R
\name{update-factor}
\alias{update-factor}
\alias{update_factor_ui}
\alias{update_factor_server}
\alias{modal_update_factor}
\title{Module to Reorder the Levels of a Factor Variable}
\usage{
update_factor_ui(id)
update_factor_server(id, data_r = reactive(NULL))
modal_update_factor(
id,
title = i18n("Update levels of a factor"),
easyClose = TRUE,
size = "l",
footer = NULL
)
}
\arguments{
\item{id}{Module ID.}
\item{data_r}{A \code{\link[shiny:reactive]{shiny::reactive()}} function returning a \code{data.frame}.}
\item{title}{An optional title for the dialog.}
\item{easyClose}{If \code{TRUE}, the modal dialog can be dismissed by
clicking outside the dialog box, or be pressing the Escape key. If
\code{FALSE} (the default), the modal dialog can't be dismissed in those
ways; instead it must be dismissed by clicking on a \code{modalButton()}, or
from a call to \code{\link[shiny:removeModal]{removeModal()}} on the server.}
\item{size}{One of \code{"s"} for small, \code{"m"} (the default) for medium,
\code{"l"} for large, or \code{"xl"} for extra large. Note that \code{"xl"} only
works with Bootstrap 4 and above (to opt-in to Bootstrap 4+,
pass \code{\link[bslib:bs_theme]{bslib::bs_theme()}} to the \code{theme} argument of a page container
like \code{\link[shiny:fluidPage]{fluidPage()}}).}
\item{footer}{UI for footer. Use \code{NULL} for no footer.}
}
\value{
A \code{\link[shiny:reactive]{shiny::reactive()}} function returning the data.
}
\description{
This module contain an interface to reorder the levels of a factor variable.
}

View file

@ -0,0 +1,23 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data_plots.R
\name{vertical_stacked_bars}
\alias{vertical_stacked_bars}
\title{Vertical stacked bar plot wrapper}
\usage{
vertical_stacked_bars(
data,
score = "full_score",
group = "pase_0_q",
strata = NULL,
t.size = 10,
l.color = "black",
l.size = 0.5,
draw.lines = TRUE
)
}
\arguments{
\item{t.size}{}
}
\description{
Vertical stacked bar plot wrapper
}