2025-03-05 21:13:06 +01:00
|
|
|
% Generated by roxygen2: do not edit by hand
|
2025-03-12 18:27:46 +01:00
|
|
|
% Please edit documentation in R/plot_sankey.R
|
2025-03-05 21:13:06 +01:00
|
|
|
\name{plot_sankey_single}
|
|
|
|
\alias{plot_sankey_single}
|
|
|
|
\title{Beautiful sankey plot}
|
|
|
|
\usage{
|
2025-04-15 16:14:03 +02:00
|
|
|
plot_sankey_single(
|
|
|
|
data,
|
|
|
|
pri,
|
|
|
|
sec,
|
|
|
|
color.group = c("pri", "sec"),
|
|
|
|
colors = NULL,
|
|
|
|
...
|
|
|
|
)
|
2025-03-05 21:13:06 +01:00
|
|
|
}
|
|
|
|
\arguments{
|
2025-03-11 13:42:57 +01:00
|
|
|
\item{color.group}{set group to colour by. "x" or "y".}
|
|
|
|
|
|
|
|
\item{colors}{optinally specify colors. Give NA color, color for each level
|
|
|
|
in primary group and color for each level in secondary group.}
|
|
|
|
|
|
|
|
\item{...}{passed to sankey_ready()}
|
2025-03-05 21:13:06 +01:00
|
|
|
}
|
|
|
|
\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")
|
2025-04-23 14:25:55 +02:00
|
|
|
ds |> plot_sankey_single("first", "last", color.group = "sec")
|
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)
|
|
|
|
) |>
|
2025-04-15 16:14:03 +02:00
|
|
|
plot_sankey_single("first", "last", color.group = "pri")
|
2025-04-23 14:25:55 +02:00
|
|
|
mtcars |>
|
|
|
|
default_parsing() |>
|
|
|
|
str()
|
|
|
|
plot_sankey_single("cyl", "vs", color.group = "pri")
|
2025-03-05 21:13:06 +01:00
|
|
|
}
|