Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- df <- data.frame(treatment = c(rep(c("Stimulation", "Control"), 8)),
- group = c(rep(c("A", "B"), 4),
- rep(c("B", "A"), 4)),
- value = rnorm(16, mean = 150, sd = 20),
- units = rep(c("u/min", "lit"), 8))
- re <- list(A = list(Stimulation = "297.00 ± 19.86", Control = "304.44 ± 14.96"),
- B = list(Stimulation = "4.51 ± 0.07", Control = "4.55 ± 0.10"))
- add_unit <- function(list, u){
- z <- lapply(list, function(x){
- list(
- Stimulation = paste(x$Stimulation, unique(u)),
- Control = paste(x$Control, unique(u)))
- })
- }
- a <- add_unit(re, u = df$units)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement