library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.3     v purrr   0.3.4
## v tibble  3.1.2     v dplyr   1.0.6
## v tidyr   1.1.3     v stringr 1.4.0
## v readr   1.4.0     v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(fansi)
library(ggplot2)

Download the file allscores from a URL

allscores <- read_csv("https://goo.gl/MJyzNs")
## 
## -- Column specification --------------------------------------------------------
## cols(
##   group = col_double(),
##   pre = col_double(),
##   post = col_double(),
##   diff = col_double()
## )

#The command “dim” provides the dimensions of the data, which are 22 observations (rows) by 4 variables (columns).

dim(allscores)
## [1] 22  4

Use Print to see the data

print(allscores)
## # A tibble: 22 x 4
##    group   pre  post  diff
##    <dbl> <dbl> <dbl> <dbl>
##  1     3  45    47.5   2.5
##  2     1  65    65     0  
##  3     1  52.5  40   -12.5
##  4     1  65    52.5 -12.5
##  5     1  60    52.5  -7.5
##  6     2  55    35   -20  
##  7     2  50    45    -5  
##  8     2  47.5  55     7.5
##  9     3  47.5  55     7.5
## 10     3  35    67.5  32.5
## # ... with 12 more rows

#Use View to take a look at the data but you need to close the file afterwards to come back to this pane.

view(allscores)

#Create a box plot named boxpl with three groups each group filled with a color.

boxpl <- allscores %>%
  ggplot() + 
  geom_boxplot(aes(y=diff, group=group,fill=group))
boxpl

# Create box plot “boxpl2” withiut a legend using guides (fill=FALSE)

boxpl2 <- boxpl + guides(fill=FALSE)
boxpl2

# Convert groups into factors 1, 2, 3

allscores$group <- as.factor(allscores$group)

allscores %>%
  mutate(group=factor(group, levels=c("1","2","3"), ordered=TRUE)) %>%
  ggplot() + 
     geom_boxplot(aes(y=diff, group=group, fill=group))

Specify the colors as white, lightgray and darkgray. Make the Y axis blank and give a tile to the chart.

allscores$group <- as.factor(allscores$group)

allscores %>%
  mutate(group=factor(group, levels=c("1","2","3"), ordered=TRUE)) %>%
  ggplot() + 
     geom_boxplot(aes(y=diff, group=group, fill=group))+
     scale_fill_manual(values=c("white","lightgray","darkgray")) +
     theme(axis.text.y=element_blank()) +
     ggtitle("Score Improvements Across Three Groups") +
     coord_flip()

```