mirror of
https://github.com/agdamsbo/FreesearchR.git
synced 2025-12-16 17:42:10 +01:00
50 lines
1.3 KiB
R
50 lines
1.3 KiB
R
% Generated by roxygen2: do not edit by hand
|
|
% Please edit documentation in R/plot_euler.R
|
|
\name{plot_euler}
|
|
\alias{plot_euler}
|
|
\title{Easily plot euler diagrams}
|
|
\usage{
|
|
plot_euler(data, pri, sec, ter = NULL, seed = 2103)
|
|
}
|
|
\arguments{
|
|
\item{data}{data}
|
|
|
|
\item{seed}{seed}
|
|
|
|
\item{x}{name of main variable}
|
|
|
|
\item{y}{name of secondary variables}
|
|
|
|
\item{z}{grouping variable}
|
|
}
|
|
\value{
|
|
patchwork object
|
|
}
|
|
\description{
|
|
Easily plot euler diagrams
|
|
}
|
|
\examples{
|
|
data.frame(
|
|
A = sample(c(TRUE, TRUE, FALSE), 50, TRUE),
|
|
B = sample(c("A", "C"), 50, TRUE),
|
|
C = sample(c(TRUE, FALSE, FALSE, FALSE), 50, TRUE),
|
|
D = sample(c(TRUE, FALSE, FALSE, FALSE), 50, TRUE)
|
|
) |> plot_euler("A", c("B", "C"), "D", seed = 4)
|
|
mtcars |> plot_euler("vs", "am", seed = 1)
|
|
mtcars |> plot_euler("vs", "am", "cyl", seed = 1)
|
|
stRoke::trial |>
|
|
dplyr::mutate(
|
|
mfi_cut = cut(mfi_6, c(0, 12, max(mfi_6, na.rm = TRUE))),
|
|
mdi_cut = cut(mdi_6, c(0, 20, max(mdi_6, na.rm = TRUE)))
|
|
) |>
|
|
purrr::map2(
|
|
c(sapply(stRoke::trial, \(.x)REDCapCAST::get_attr(.x, attr = "label")), "Fatigue", "Depression"),
|
|
\(.x, .y){
|
|
REDCapCAST::set_attr(.x, .y, "label")
|
|
}
|
|
) |>
|
|
dplyr::bind_cols() |>
|
|
plot_euler("mfi_cut", "mdi_cut")
|
|
stRoke::trial |>
|
|
plot_euler(pri="male", sec=c("hypertension"))
|
|
}
|