data <-c(23, 30, 54, 28, 31, 29, 34, 35, 30,27, 21, 43, 51, 35, 51, 49, 35, 24,26, 29, 21, 29, 37, 27, 28, 33, 33,23, 37, 27, 40, 48, 41, 20, 30, 57)
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)
dotchart(data, main = "# of Dendritic Branch Segments from Guinea Pig Brain Cells", xlab = "# of Segments")
hist (data, main = "Histogram of Dendritic Branch Segments from Guinea Pig Brain Cells", xlab = "Number of Segments/Cell")
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
## Warning: package 'mosaicData' was built under R version 4.0.2
## 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
dotplot(data, main = "# of Dendritic Branch Segments from Guinea Pig Brain Cells", xlab = "# of Segments/Cell")
table(data)
## data
## 20 21 23 24 26 27 28 29 30 31 33 34 35 37 40 41 43 48 49 51 54 57
## 1 2 2 1 1 3 2 3 3 1 2 1 3 2 1 1 1 1 1 2 1 1
coli <- c(14,15,13,21,15,14,26,16,20,13)
hist(coli, main = "# Bacteria Resistant to a Certain Virus", xlab = "# of Bacteria Resistant")
avg <-mean(coli)
med <- median(coli)
abline(v = avg, col = "red")
abline(v = med, col = "blue")
milkyield <- c(56.5, 89.8, 110.1, 65.6, 63.7, 82.6, 75.1, 91.5, 102.9, 44.4, 108.1)
summary(milkyield)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 44.40 64.65 82.60 80.94 97.20 110.10
boxplot (milkyield, main = "Milk Yield from 11 Ewes")
rowan_data3 <- read.csv("C:/Users/Jerome/Documents/Math_217/rowan_data3.csv", header = FALSE)
Create Altitude and Respiration
altitude <-c(90, 230, 240, 260, 330, 400, 410, 550, 590, 610, 700, 790)
respiration <- c(0.11, 0.20, 0.13, 0.15, 0.18, 0.16, 0.23, 0.18, 0.23, 0.26, 0.32, 0.37)
plot (altitude, respiration, main = "Scatterplot of Rowan Altitude and Respiration", xlab = "Altitude", ylab = "Respiration")
fit <- lm(respiration ~ altitude)
abline(fit)
cor(altitude,respiration, method = "pearson")
## [1] 0.8866526
male <- c(6, 0, 2, 1, 2, 4.5, 8, 3, 17, 4.5, 4, 5)
female <-c(5, 13, 3, 2, 6, 14, 3, 1, 1.5, 1.5, 3, 8, 4)
boxplot (male, main = "Male Average Weekly Exercise Hours")
boxplot (female, main = "Female Average Weekly Exercise Hours")
sd(male)
## [1] 4.449208
sd(female)
## [1] 4.257347
t.test(male,female)
##
## Welch Two Sample t-test
##
## data: male and female
## t = -0.14329, df = 22.632, p-value = 0.8873
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -3.862362 3.362362
## sample estimates:
## mean of x mean of y
## 4.75 5.00
mean(male)
## [1] 4.75
mean(female)
## [1] 5
seedlings <- c(1.45, 1.19, 1.05, 1.07)
mean(seedlings)
## [1] 1.19
sd(seedlings)
## [1] 0.184029
timololin <-c(-13, -29, -7, 2, -10, -43, 4, 15, -13, -30)
mean(timololin)
## [1] -12.4
sd(timololin)
## [1] 17.58914
lizards <- c(18.4, 22.2, 24.5, 26.4, 27.5, 28.7, 30.6, 32.9, 32.9, 34, 34.8, 37.5, 42.1, 45.5, 45.5)
summary(lizards)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 18.40 26.95 32.90 32.23 36.15 45.50
seizure <-c(5, 0, 9, 6, 0, 0, 5, 0, 6, 1, 5, 0, 0, 0, 0, 7, 0, 0, 4, 7)
table(seizure)
## seizure
## 0 1 4 5 6 7 9
## 10 1 1 3 2 2 1
sd(seizure)
## [1] 3.176807
mean(seizure)
## [1] 2.75
median(seizure)
## [1] 0.5
hist(seizure)
pony <- c(35, 19, 33, 34, 17, 26, 16, 40, 28, 30, 23, 12, 27, 33, 22, 31, 28, 28, 35, 23, 23, 19, 29)
summary(pony)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 12.00 22.50 28.00 26.57 32.00 40.00
boxplot(pony, main = "Nerve Cells in Pony Intestine")