question 1
my.vec <- c(1,2,3,4,5)
my.vec
## [1] 1 2 3 4 5
group9.mean <- 3
group9.mean
## [1] 3
question 2
multiples.of.five <- seq(from = 0, to = 100, by = 5)
multiples.of.five
## [1] 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80
## [18] 85 90 95 100
question 3
rep(c(1, 2), times = 4)
## [1] 1 2 1 2 1 2 1 2
question 4
rep(c(1, 2), times = 1, each = 4)
## [1] 1 1 1 1 2 2 2 2
question 5
c(seq(from = 10, to = 50, by = 10), 12:14, seq(from = 97, to = 137, by = 10))
## [1] 10 20 30 40 50 12 13 14 97 107 117 127 137
question 6
group.assignment <- rep(x = 1:4, length.out = 100)
group.assignment
## [1] 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3
## [36] 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2
## [71] 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4
question 7
celsius <- c(17, 21, 18, 21, 14)
celsius
## [1] 17 21 18 21 14
Fahrenheit <- celsius* 9/5+32
Fahrenheit
## [1] 62.6 69.8 64.4 69.8 57.2
question 8
celsius.corrected <- celsius-0.5
celsius.corrected
## [1] 16.5 20.5 17.5 20.5 13.5
question 9
student.fries <- c(119, 124, 121, 79, 94, 106, 88, 128, 94, 80)
student.fries
## [1] 119 124 121 79 94 106 88 128 94 80
professor.fries <- c(131, 93, 103, 96, 101, 114, 125, 116, 116, 114)
professor.fries
## [1] 131 93 103 96 101 114 125 116 116 114
question 10
mean(student.fries)
## [1] 103.3
mean(professor.fries)
## [1] 110.9
question 11
sd(student.fries)
## [1] 18.6967
sd(professor.fries)
## [1] 12.36887
question 12
student.meandiff <- student.fries-mean(student.fries)
student.meandiff
## [1] 15.7 20.7 17.7 -24.3 -9.3 2.7 -15.3 24.7 -9.3 -23.3
question 13
before.rawmeat <- c(31, 21, 25, 28, 26, 37, 27, 31, 39, 37)
after.rawmeat <- c(32, 43, 40, 35, 48, 42, 38, 38, 41, 50)
before.mean <- mean(before.rawmeat)
before.mean
## [1] 30.2
after.mean <- mean(after.rawmeat)
after.mean
## [1] 40.7
question 14
beard.change <- after.rawmeat-before.rawmeat
beard.change
## [1] 1 22 15 7 22 5 11 7 2 13
question 15
max(beard.change)
## [1] 22
min(beard.change)
## [1] 1
question 16
Final.exam <- c(80, 93, 76, 88, 76, 98, 73, 80, 71, 82)
surprise.exam <- c(66, 87, 62, 79, 66, 96, 67, 73, 60, 78)
finalexam.mean <- mean(Final.exam)
finalexam.mean
## [1] 81.7
finalexam.median <- median(Final.exam)
finalexam.median
## [1] 80
surpriseexam.mean <- mean(surprise.exam)
surpriseexam.mean
## [1] 73.4
surpriseexam.median <- median(surprise.exam)
surpriseexam.median
## [1] 70
question 17
change <- surprise.exam-Final.exam
change
## [1] -14 -6 -14 -9 -10 -2 -6 -7 -11 -4
question 18
median.change <- median(change)
median.change
## [1] -8
question 19
par.1 <- c(1,2,1)
par.2 <- c(4,7,6)
par.3 <- c(1,5,3)
par.4 <- c(2,2,2)
par.5 <- c(7,7,7)
BIS.scores <- c(mean(par.1), mean(par.2), mean(par.3), mean(par.4), mean(par.5))
BIS.scores
## [1] 1.333333 5.666667 3.000000 2.000000 7.000000