Homework 1

Published

February 7, 2023

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:

x <- matrix(rnorm(1500), nrow = 10)

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:

y <- matrix(sample(1:400, 100, replace = T), nrow = 10)

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.