Motivation

Load database and read it in Rstudio:

library(dplyr)
## Warning: package 'dplyr' was built under R version 3.6.3
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
dat <- read.csv("C:/Users/le11/Desktop/MOOC/EdX/R and statistics/Statdata/femaleMiceWeights.csv")

Divide into 2 groups

control <- filter(dat,Diet=="chow") %>%select(Bodyweight) %>% unlist
treatment <- filter(dat, Diet=="hf") %>% select(Bodyweight) %>% unlist
View(control)
View(treatment)

Calculate mean values of 2 groups

mean(treatment)
## [1] 26.83417
mean(control)
## [1] 23.81333