library(tidyverse)
## Warning: package 'tidyverse' was built under R version 4.0.2
## -- Attaching packages --------------------------------------- tidyverse 1.3.0 --
## v ggplot2 3.3.2 v purrr 0.3.4
## v tibble 3.0.3 v dplyr 1.0.2
## v tidyr 1.1.2 v stringr 1.4.0
## v readr 1.3.1 v forcats 0.5.0
## Warning: package 'tibble' was built under R version 4.0.2
## Warning: package 'tidyr' was built under R version 4.0.2
## Warning: package 'dplyr' was built under R version 4.0.2
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(ggplot2)
library(dplyr)
library(mosaic)
## Warning: package 'mosaic' was built under R version 4.0.2
## Loading required package: lattice
## Loading required package: ggformula
## Warning: package 'ggformula' was built under R version 4.0.2
## Loading required package: ggstance
## Warning: package 'ggstance' was built under R version 4.0.2
##
## Attaching package: 'ggstance'
## The following objects are masked from 'package:ggplot2':
##
## geom_errorbarh, GeomErrorbarh
##
## New to ggformula? Try the tutorials:
## learnr::run_tutorial("introduction", package = "ggformula")
## learnr::run_tutorial("refining", package = "ggformula")
## Loading required package: mosaicData
## Loading required package: Matrix
##
## Attaching package: 'Matrix'
## The following objects are masked from 'package:tidyr':
##
## expand, pack, unpack
## Registered S3 method overwritten by 'mosaic':
## method from
## fortify.SpatialPolygonsDataFrame ggplot2
##
## The 'mosaic' package masks several functions from core packages in order to add
## additional features. The original behavior of these functions should not be affected by this.
##
## Note: If you use the Matrix package, be sure to load it BEFORE loading mosaic.
##
## Have you tried the ggformula package for your plots?
##
## Attaching package: 'mosaic'
## The following object is masked from 'package:Matrix':
##
## mean
## The following objects are masked from 'package:dplyr':
##
## count, do, tally
## The following object is masked from 'package:purrr':
##
## cross
## The following object is masked from 'package:ggplot2':
##
## stat
## The following objects are masked from 'package:stats':
##
## binom.test, cor, cor.test, cov, fivenum, IQR, median, prop.test,
## quantile, sd, t.test, var
## The following objects are masked from 'package:base':
##
## max, mean, min, prod, range, sample, sum
library(openintro)
## Warning: package 'openintro' was built under R version 4.0.2
## Loading required package: airports
## Warning: package 'airports' was built under R version 4.0.2
## Loading required package: cherryblossom
## Warning: package 'cherryblossom' was built under R version 4.0.2
## Loading required package: usdata
## Warning: package 'usdata' was built under R version 4.0.2
##
## Attaching package: 'openintro'
## The following object is masked from 'package:mosaic':
##
## dotPlot
## The following objects are masked from 'package:lattice':
##
## ethanol, lsegments
getwd()
## [1] "C:/Users/Jerome/Documents/Math_217"
Problem 2, Quiz 2
#soybeans <- read.csv("soybeans.csv")
low <-c(264, 200, 22, 268, 215, 241, 232, 256, 229, 288, 253, 288, 230)
mod <- c(314, 320, 310, 340, 299, 268, 345, 271, 285, 309, 337, 282,273)
plot (low, mod, main = "Scatterplot of Soybean Leaf Size under 2 Growing Conditions", xlab = "Low LIght", ylab = "Moderate Light")
fit <- lm(mod ~ low)
abline (fit)

Problem 1, Quiz 2
males <- c(373, 327, 274, 292, 274, 280, 301, 315, 285, 299, 320, 249, 313, 222, 254, 289, 300, 295, 292, 267 )
mean (males)
## [1] 291.05
median (males)
## [1] 292
sd (males)
## [1] 31.94811
summary(males)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 222.0 274.0 292.0 291.1 304.0 373.0
boxplot (males, main = "Serum Cholesterol Levels of 20 Males")

hist (males, main = "Histogram of Serum Cholesterol Levels of 20 Males", xlab = "Serum Cholesterol Levels")

males <-read.csv("males.csv")
title <- "Histogram of Serum Cholesterol Levels of 20 Males"
hist <-ggplot (males, aes(x = cholesterol)) +
geom_histogram(bins = 100) +
labs (y = "Frequency", x = "Serum Cholesterol Levels")+
ggtitle(title)
print(hist)
