2025-03-05 21:13:06 +01:00
|
|
|
% Generated by roxygen2: do not edit by hand
|
2025-10-31 11:39:12 +01:00
|
|
|
% Please edit documentation in R/data_plots.R, R/plot_bar.R, R/plot_box.R,
|
2026-03-30 20:17:13 +02:00
|
|
|
% R/plot_hbar.R, R/plot_likert.R, R/plot_ridge.R, R/plot_sankey.R,
|
|
|
|
|
% R/plot_scatter.R, R/plot_violin.R
|
2025-03-05 21:13:06 +01:00
|
|
|
\name{data-plots}
|
|
|
|
|
\alias{data-plots}
|
2025-03-13 12:41:50 +01:00
|
|
|
\alias{data_visuals_ui}
|
|
|
|
|
\alias{data_visuals_server}
|
2025-03-05 21:13:06 +01:00
|
|
|
\alias{create_plot}
|
2026-04-10 21:04:42 +02:00
|
|
|
\alias{plot_bar}
|
2025-10-31 11:39:12 +01:00
|
|
|
\alias{plot_bar_single}
|
2025-03-24 14:43:50 +01:00
|
|
|
\alias{plot_box}
|
|
|
|
|
\alias{plot_box_single}
|
2025-03-05 21:13:06 +01:00
|
|
|
\alias{plot_hbars}
|
2026-03-30 20:17:13 +02:00
|
|
|
\alias{plot_likert}
|
2025-03-13 12:41:50 +01:00
|
|
|
\alias{plot_ridge}
|
2025-03-11 13:42:57 +01:00
|
|
|
\alias{sankey_ready}
|
2025-03-05 21:13:06 +01:00
|
|
|
\alias{plot_sankey}
|
2025-03-13 12:41:50 +01:00
|
|
|
\alias{plot_scatter}
|
|
|
|
|
\alias{plot_violin}
|
|
|
|
|
\title{Data correlations evaluation module}
|
2025-03-05 21:13:06 +01:00
|
|
|
\usage{
|
2025-03-13 12:41:50 +01:00
|
|
|
data_visuals_ui(id, tab_title = "Plots", ...)
|
|
|
|
|
|
2026-03-31 20:42:22 +02:00
|
|
|
data_visuals_server(id, data, palettes, ...)
|
2025-03-05 21:13:06 +01:00
|
|
|
|
2026-03-24 12:04:54 +01:00
|
|
|
create_plot(data, type, pri, sec, ter = NULL, color.palette = "viridis", ...)
|
2025-03-05 21:13:06 +01:00
|
|
|
|
2026-04-10 21:04:42 +02:00
|
|
|
plot_bar(
|
|
|
|
|
data,
|
|
|
|
|
pri,
|
|
|
|
|
sec = NULL,
|
|
|
|
|
ter = NULL,
|
|
|
|
|
style = c("stack", "dodge", "fill"),
|
|
|
|
|
color.palette = "viridis",
|
|
|
|
|
max_level = 30,
|
|
|
|
|
...
|
|
|
|
|
)
|
|
|
|
|
|
2025-10-31 11:39:12 +01:00
|
|
|
plot_bar_single(
|
|
|
|
|
data,
|
|
|
|
|
pri,
|
|
|
|
|
sec = NULL,
|
|
|
|
|
style = c("stack", "dodge", "fill"),
|
2026-03-24 12:04:54 +01:00
|
|
|
max_level = 30,
|
|
|
|
|
color.palette = "viridis"
|
2025-10-31 11:39:12 +01:00
|
|
|
)
|
|
|
|
|
|
2026-03-24 12:04:54 +01:00
|
|
|
plot_box(data, pri, sec, ter = NULL, color.palette = "viridis", ...)
|
2025-03-24 14:43:50 +01:00
|
|
|
|
2026-03-24 12:04:54 +01:00
|
|
|
plot_box_single(data, pri, sec = NULL, seed = 2103, color.palette = "viridis")
|
2025-03-24 14:43:50 +01:00
|
|
|
|
2026-03-24 12:04:54 +01:00
|
|
|
plot_hbars(data, pri, sec, ter = NULL, color.palette = "viridis")
|
2025-03-05 21:13:06 +01:00
|
|
|
|
2026-03-30 20:17:13 +02:00
|
|
|
plot_likert(data, pri, sec = NULL, ter = NULL, color.palette = "viridis")
|
|
|
|
|
|
2026-03-24 12:04:54 +01:00
|
|
|
plot_ridge(data, x, y, z = NULL, color.palette = "viridis", ...)
|
2025-03-05 21:13:06 +01:00
|
|
|
|
2025-04-15 16:14:03 +02:00
|
|
|
sankey_ready(data, pri, sec, numbers = "count", ...)
|
2025-03-11 13:42:57 +01:00
|
|
|
|
2025-10-21 21:30:07 +03:00
|
|
|
plot_sankey(
|
|
|
|
|
data,
|
|
|
|
|
pri,
|
|
|
|
|
sec,
|
|
|
|
|
ter = NULL,
|
|
|
|
|
color.group = "pri",
|
|
|
|
|
colors = NULL,
|
2026-03-24 12:04:54 +01:00
|
|
|
color.palette = "viridis",
|
|
|
|
|
default.color = "#2986cc",
|
|
|
|
|
box.color = "#1E4B66",
|
|
|
|
|
na.color = "grey80",
|
2025-10-21 21:30:07 +03:00
|
|
|
missing.level = "Missing"
|
|
|
|
|
)
|
2025-03-13 12:41:50 +01:00
|
|
|
|
2026-03-24 12:04:54 +01:00
|
|
|
plot_scatter(data, pri, sec, ter = NULL, color.palette = "viridis")
|
2025-03-13 12:41:50 +01:00
|
|
|
|
2026-03-24 12:04:54 +01:00
|
|
|
plot_violin(data, pri, sec, ter = NULL, color.palette = "viridis")
|
2025-03-05 21:13:06 +01:00
|
|
|
}
|
|
|
|
|
\arguments{
|
2025-03-13 12:41:50 +01:00
|
|
|
\item{id}{Module id. (Use 'ns("id")')}
|
|
|
|
|
|
2025-06-27 11:11:01 +02:00
|
|
|
\item{...}{passed on to wrap_plot_list}
|
2025-03-13 12:41:50 +01:00
|
|
|
|
2025-06-27 11:11:01 +02:00
|
|
|
\item{data}{data frame}
|
2025-03-11 13:42:57 +01:00
|
|
|
|
2025-03-13 12:41:50 +01:00
|
|
|
\item{type}{plot type (derived from possible_plots() and matches custom function)}
|
|
|
|
|
|
2025-04-15 16:14:03 +02:00
|
|
|
\item{pri}{primary variable}
|
2025-03-11 13:42:57 +01:00
|
|
|
|
2025-04-15 16:14:03 +02:00
|
|
|
\item{sec}{secondary variable}
|
2025-03-11 13:42:57 +01:00
|
|
|
|
2025-04-15 16:14:03 +02:00
|
|
|
\item{ter}{tertiary variable}
|
2025-10-31 11:39:12 +01:00
|
|
|
|
2026-03-24 12:04:54 +01:00
|
|
|
\item{color.palette}{choose color palette. See \code{\link{plot_colors}} for support.}
|
|
|
|
|
|
2025-10-31 11:39:12 +01:00
|
|
|
\item{style}{barplot style passed to geom_bar position argument.
|
|
|
|
|
One of c("stack", "dodge", "fill")}
|
2025-03-05 21:13:06 +01:00
|
|
|
}
|
|
|
|
|
\value{
|
2025-03-13 12:41:50 +01:00
|
|
|
Shiny ui module
|
2025-03-05 21:13:06 +01:00
|
|
|
|
2025-03-13 12:41:50 +01:00
|
|
|
shiny server module
|
2025-03-05 21:13:06 +01:00
|
|
|
|
|
|
|
|
ggplot2 object
|
|
|
|
|
|
2026-04-10 21:04:42 +02:00
|
|
|
ggplot list object
|
|
|
|
|
|
2025-10-31 11:39:12 +01:00
|
|
|
ggplot object
|
|
|
|
|
|
2025-03-05 21:13:06 +01:00
|
|
|
ggplot2 object
|
|
|
|
|
|
2025-03-24 14:43:50 +01:00
|
|
|
ggplot object
|
|
|
|
|
|
|
|
|
|
ggplot2 object
|
|
|
|
|
|
2025-03-05 21:13:06 +01:00
|
|
|
ggplot2 object
|
|
|
|
|
|
2026-03-30 20:17:13 +02:00
|
|
|
ggplot2 object
|
|
|
|
|
|
2025-03-11 13:42:57 +01:00
|
|
|
data.frame
|
|
|
|
|
|
2025-03-13 12:41:50 +01:00
|
|
|
ggplot2 object
|
|
|
|
|
|
|
|
|
|
ggplot2 object
|
|
|
|
|
|
2025-03-05 21:13:06 +01:00
|
|
|
ggplot2 object
|
|
|
|
|
}
|
|
|
|
|
\description{
|
2025-03-13 12:41:50 +01:00
|
|
|
Data correlations evaluation module
|
2025-03-05 21:13:06 +01:00
|
|
|
|
|
|
|
|
Wrapper to create plot based on provided type
|
|
|
|
|
|
2026-04-10 21:04:42 +02:00
|
|
|
Title
|
|
|
|
|
|
2025-10-31 11:39:12 +01:00
|
|
|
Single vertical barplot
|
|
|
|
|
|
2025-03-24 14:43:50 +01:00
|
|
|
Beautiful box plot(s)
|
|
|
|
|
|
|
|
|
|
Create nice box-plots
|
|
|
|
|
|
2025-03-05 21:13:06 +01:00
|
|
|
Nice horizontal stacked bars (Grotta bars)
|
|
|
|
|
|
2026-03-30 20:17:13 +02:00
|
|
|
Nice horizontal bar plot centred on the central category
|
|
|
|
|
|
2025-03-13 12:41:50 +01:00
|
|
|
Plot nice ridge plot
|
2025-03-05 21:13:06 +01:00
|
|
|
|
2025-03-11 13:42:57 +01:00
|
|
|
Readying data for sankey plot
|
|
|
|
|
|
2025-03-05 21:13:06 +01:00
|
|
|
Beautiful sankey plot with option to split by a tertiary group
|
2025-03-13 12:41:50 +01:00
|
|
|
|
|
|
|
|
Beautiful violin plot
|
|
|
|
|
|
2026-03-24 12:04:54 +01:00
|
|
|
Beautiful violin plot
|
2025-03-05 21:13:06 +01:00
|
|
|
}
|
|
|
|
|
\examples{
|
2025-04-15 16:14:03 +02:00
|
|
|
create_plot(mtcars, "plot_violin", "mpg", "cyl") |> attributes()
|
2026-04-10 21:04:42 +02:00
|
|
|
mtcars |>
|
|
|
|
|
dplyr::mutate(cyl = factor(cyl), am = factor(am)) |>
|
|
|
|
|
plot_bar(pri = "cyl", sec = "am", style = "fill")
|
|
|
|
|
|
|
|
|
|
mtcars |>
|
|
|
|
|
dplyr::mutate(dplyr::across(tidyselect::all_of(c("cyl","am","gear")),factor)) |>
|
|
|
|
|
plot_bar(pri = "cyl", sec = "gear", ter = "am", style = "stack",color.palette="turbo")
|
2025-10-31 11:39:12 +01:00
|
|
|
mtcars |>
|
|
|
|
|
dplyr::mutate(cyl = factor(cyl), am = factor(am)) |>
|
|
|
|
|
plot_bar_single(pri = "cyl", sec = "am", style = "fill")
|
|
|
|
|
|
|
|
|
|
mtcars |>
|
|
|
|
|
dplyr::mutate(cyl = factor(cyl), am = factor(am)) |>
|
2026-03-24 12:04:54 +01:00
|
|
|
plot_bar_single(pri = "cyl", style = "stack",color.palette="turbo")
|
2025-06-27 11:11:01 +02:00
|
|
|
mtcars |> plot_box(pri = "mpg", sec = "gear")
|
|
|
|
|
mtcars |> plot_box(pri = "mpg", sec="cyl")
|
2025-03-24 14:43:50 +01:00
|
|
|
mtcars |>
|
|
|
|
|
default_parsing() |>
|
2025-04-15 16:14:03 +02:00
|
|
|
plot_box(pri = "mpg", sec = "cyl", ter = "gear")
|
2025-06-27 11:11:01 +02:00
|
|
|
mtcars |>
|
|
|
|
|
default_parsing() |>
|
|
|
|
|
plot_box(pri = "mpg", sec = "cyl", ter = "gear",axis.font.family="mono")
|
2025-04-23 14:25:38 +02:00
|
|
|
mtcars |> plot_box_single("mpg")
|
2026-03-24 12:04:54 +01:00
|
|
|
mtcars |> plot_box_single("mpg","cyl",color.palette="Blues")
|
|
|
|
|
stRoke::trial |> plot_box_single("age","active",color.palette="Blues")
|
2025-06-27 11:11:01 +02:00
|
|
|
gtsummary::trial |> plot_box_single("age","trt")
|
2025-04-15 16:14:03 +02:00
|
|
|
mtcars |> plot_hbars(pri = "carb", sec = "cyl")
|
2025-08-08 11:49:09 +02:00
|
|
|
mtcars |> plot_hbars(pri = "carb", sec = "cyl", ter="am")
|
2026-03-24 12:04:54 +01:00
|
|
|
mtcars |> plot_hbars(pri = "carb", sec = NULL,color.palette="Blues")
|
|
|
|
|
mtcars |> plot_hbars(pri = "carb", sec = NULL,color.palette="Magma")
|
2026-03-31 20:42:22 +02:00
|
|
|
mtcars |> plot_hbars(pri = "carb", sec = "am",color.palette="Viridis")
|
2026-03-30 20:17:13 +02:00
|
|
|
mtcars |> plot_likert(pri = "carb", sec = "cyl")
|
|
|
|
|
mtcars |> plot_likert(pri = "carb", sec = "cyl", ter="am")
|
|
|
|
|
mtcars |> plot_likert(pri = "cyl",color.palette="Blues")
|
|
|
|
|
mtcars |> plot_likert(pri = "carb", sec = NULL,color.palette="Magma")
|
|
|
|
|
mtcars |> plot_likert(pri = "carb", sec = c("cyl","am"),color.palette="Viridis")
|
2025-03-05 21:13:06 +01:00
|
|
|
mtcars |>
|
|
|
|
|
default_parsing() |>
|
|
|
|
|
plot_ridge(x = "mpg", y = "cyl")
|
|
|
|
|
mtcars |> plot_ridge(x = "mpg", y = "cyl", z = "gear")
|
2025-03-11 13:42:57 +01:00
|
|
|
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")
|
2025-03-12 18:27:46 +01:00
|
|
|
data.frame(
|
|
|
|
|
g = sample(LETTERS[1:2], 100, TRUE),
|
|
|
|
|
first = REDCapCAST::as_factor(sample(letters[1:4], 100, TRUE)),
|
|
|
|
|
last = sample(c(TRUE, FALSE, FALSE), 100, TRUE)
|
|
|
|
|
) |>
|
|
|
|
|
sankey_ready("first", "last")
|
2025-03-05 21:13:06 +01:00
|
|
|
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")
|
2025-04-23 14:25:38 +02:00
|
|
|
ds |> plot_sankey("first", "last", color.group = "sec")
|
|
|
|
|
ds |> plot_sankey("first", "last", ter = "g", color.group = "sec")
|
|
|
|
|
mtcars |>
|
|
|
|
|
default_parsing() |>
|
|
|
|
|
plot_sankey("cyl", "gear", "am", color.group = "pri")
|
|
|
|
|
## In this case, the last plot as the secondary variable in wrong order
|
|
|
|
|
## Dont know why...
|
|
|
|
|
mtcars |>
|
|
|
|
|
default_parsing() |>
|
2026-03-24 12:04:54 +01:00
|
|
|
plot_sankey("cyl", "gear", "vs", color.group = "pri",color.palette="inferno")
|
2025-04-15 16:14:03 +02:00
|
|
|
mtcars |> plot_scatter(pri = "mpg", sec = "wt")
|
2026-03-24 12:04:54 +01:00
|
|
|
mtcars |> plot_scatter(pri = "mpg", sec = "wt",ter="carb")
|
|
|
|
|
mtcars |> plot_violin(pri = "mpg", sec = "cyl")
|
|
|
|
|
mtcars |> plot_violin(pri = "mpg", sec = "cyl", ter = "gear", color.palette="Blues")
|
2025-03-05 21:13:06 +01:00
|
|
|
}
|