R/scrub_code.R

# testplot <- function(meansdf, xvar = "condition", yvar = "means",
#                      fillvar = "condition") {
#   p <- ggplot(meansdf,
#               aes_string(x = xvar, y= yvar, fill = fillvar)) +
#     geom_bar(position="dodge", stat="identity")
# }
# 
# 
# 
# testplot <- function(meansdf)
# {
#   scale <- 0.5
#   p <- ggplot(meansdf, 
#               aes(fill = condition,
#                   y = means * scale,
#                   x = condition),
#               environment = environment())   # This is the KEY line 
#   p + geom_bar(position = "dodge", stat = "identity")
# }
# 
# ## Now, the following works
# testplot(means)
moj-analytical-services/las_rap_code_library documentation built on July 30, 2023, 5:54 p.m.