Extracting mean values from a boxplot and performing a t.test

Hello. I am working with a dataset that I am using to develop some plots and run some stats. Here is my original dataset:

> pacman::p_load(pacman, party, rio, tidyverse) 
> Cellphone_models <- read.csv("~/Desktop/Cellphone models.csv") 
> Cellphone_models <- read.csv("~/Desktop/Cellphone models.csv") 
> Cellphone_models
   Cellphone.model Dimensions Price
1          Model A       10.3   400
2          Model A       10.5   350
3          Model A       10.2   300
4          Model A       10.1   400
5          Model A       10.0   500
6          Model B       10.0   450
7          Model B       10.1   300
8          Model B       10.2   200
9          Model B        9.9    45
10         Model C       10.0   475
11         Model C       10.2   560
12         Model D        9.8   400
13         Model D        9.9   350
14         Model D       10.2   300
15         Model D       10.0   400
16         Model D       10.0   500
17         Model D       10.1   450
18         Model E        9.9   200
19         Model E        9.9    45
20         Model E        9.0   475
> Cellphone_models %>% group_by(Cellphone.model) %>% summarise_if(is.numeric, mean)
# A tibble: 5 x 3
  Cellphone.model Dimensions Price
  <fct>                <dbl> <dbl>
1 Model A               10.2  390 
2 Model B               10.0  249.
3 Model C               10.1  518.
4 Model D               10    400 
5 Model E                9.6  240

I then developed a boxplot showing the relationship between cell phone models and their dimensions (cm) using the following code:

boxplot(Dimensions~Cellphone.model)

Here is where I need some help:

  1. How can I display the mean values of each of the 5 individual box plots (i.e. cell phone model types on the x-axis) within the graph?

  2. Is there a t-test code that will allow me to compare the significance of difference in mean values between the two cell phone model types (e.g. Model B and D (using Model D as a reference mean value).

Thanks!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.