FreesearchR/man/data-plots.Rd

89 lines
2.2 KiB
Text
Raw Normal View History

2025-03-05 21:13:06 +01:00
% 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}
2025-03-11 13:42:57 +01:00
\alias{sankey_ready}
2025-03-05 21:13:06 +01:00
\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)
2025-03-11 13:42:57 +01:00
sankey_ready(data, x, y, z = NULL, numbers = "count")
2025-03-05 21:13:06 +01:00
plot_sankey(data, x, y, z = NULL, color.group = "x", colors = NULL)
}
\arguments{
2025-03-11 13:42:57 +01:00
\item{data}{data.frame}
\item{x}{primary variable}
\item{y}{secondary variable}
\item{z}{tertiary variable}
2025-03-05 21:13:06 +01:00
\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
2025-03-11 13:42:57 +01:00
data.frame
2025-03-05 21:13:06 +01:00
ggplot2 object
}
\description{
Title
Wrapper to create plot based on provided type
Nice horizontal stacked bars (Grotta bars)
Beatiful violin plot
Beautiful violin plot
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
}
\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")
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-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")
ds |> plot_sankey("first", "last", color.group = "y")
ds |> plot_sankey("first", "last", z = "g", color.group = "y")
}