library(smplot2)
library(ggplot2)
set.seed(1) # generate random data
day1 <- rnorm(16, 2, 1)
day2 <- rnorm(16, 5, 1)
Subject <- rep(paste0("S", seq(1:16)), 2)
Data <- data.frame(Value = matrix(c(day1, day2), ncol = 1))
Day <- rep(c("Day 1", "Day 2"), each = length(day1))
df <- cbind(Subject, Data, Day)
# with aesthetic defaults of smplot
ggplot(data = df, mapping = aes(x = Day, y = Value, color = Day)) +
sm_bar() +
scale_color_manual(values = sm_color("blue", "orange"))
Run the code above in your browser using DataLab