Section 1

Student = c(“Mary”, “Albert”, “John”, “William”, “Bruce”, “Polly”, “Victoria”, “Flora”, “Richard”, “Melvin”) # Character vector

Quiz1 = c(68, 100, 84, 99, 100, 57, 96, 82, 98, 62) # Numeric vector

Quiz2 = c(70, 100, 86, 100, 100, 59, 98, 85, 100, 76) # Numeric vector

DF = data.frame(Student, Quiz1, Quiz2) # Create data table with three columns and name it DF

print(DF)

MeanDF = data.frame(Quiz1, Quiz2) # Create data table with two columns and name it MeanDF

Result = apply(MeanDF, 2, mean) # Using apply(), calculate means of columns in MeanDF data table

names(Result) = c(“Mean of Quiz1”, " Mean of Quiz2") # Rename Result to specify what the results mean, in this case, means of both quizzes

print(Result)

Section 2

n = 25 # Can be any number, just used this number for example

fibo = function(n) # Create function fibo to calculate Fibonacci sequence F = 1:n # Assign F variable as 1 via the nth term F[1] = 1 # Assign first term in F as 1 F[2] = 1 # Assign second term in F as 1

for (i in 3:n){ # Using a for loop, F[i] = F[i-1] + F[i-2] # Run through each iteration of i, starting with the third term, to the nth }

print(F)