Skip to content

Instantly share code, notes, and snippets.

@z3tt
Created June 14, 2021 10:28
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Data for Raincloud Plots
set.seed(2021)
data <- tibble(
group = factor(c(rep("Group 1", 100), rep("Group 2", 250), rep("Group 3", 25))),
value = c(
## Group 1
seq(0, 20, length.out = 100),
## Group 2
c(rep(0, 5), rnorm(30, 2, .1), rnorm(90, 5.4, .1), rnorm(90, 14.6, .1), rnorm(30, 18, .1), rep(20, 5)),
## Group 3
rep(seq(0, 20, length.out = 5), 5))
) %>%
rowwise() %>%
mutate(value = if_else(group == "Group 2", value + rnorm(1, 0, .4), value))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment