2017-10-10 127 views

回答

0

像這樣:

# Make example dataset 
X = data.frame("Run" = sample(c(1:3), 100, replace = T), 
       "Time" = abs(rnorm(100))) 

# Subset your data to only include Run 1 
X2 = X[X$Run == 1, ] # could also do with "subset(X, Run == 1)" 

# Make boxplot in base R 
boxplot(X2$Time, main = "Boxplot of Run 1", ylab = "Time") 

# Make prettier boxplot in ggplot 
library(ggplot2) 
ggplot(data = X2, aes(x = "", y = Time)) + 
    geom_boxplot() + 
    xlab("") + ggtitle("Boxplot of Run 1") 
+0

應該是'箱線圖(X2 $時間)' – emilliman5

相關問題