<- matrix(rnorm(1500), nrow = 10) x
Homework 1
Due 2/10/23 @ 11:59 PM
Use an RMD Notebook file from to create the assignment.
You must comment all your code to receive credit.
Submit the *nb.html file to canvas.
For all problems, you must use at least one for
or while
loop.
Problem 1
Using the following code:
Write the code to produce the output if you use the rowMeans()
on the R object x
.
Problem 2
Write the code to generate the 10th row of Pascal’s Triangle.
Problem 3
Using the following code:
<- matrix(sample(1:400, 100, replace = T), nrow = 10) y
Find the median value for each column of the matrix y
. You are not allowed to use the median()
function.
Problem 4
Write the code that will generate the first 1000 numbers of the Fibonacci sequence.