Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3. (6 points) Each of the following problems involves a situation that can be represented by using vectors in R. For help, see Screenshot examples

image text in transcribedimage text in transcribed
3. (6 points) Each of the following problems involves a situation that can be represented by using vectors in R. For help, see Screenshot examples 8, 9, 10, 11 and 12 in the Tutorial for Problem Set 1. For each problem: . Include a comment line above the R code with a very brief description of each situation (the comment should fit on one line). Write R code and execute the code in RStudio. In the document that you submit, include an image showing the comment, the R code, and the output as displayed in the console of RStudio. You can include images containing R code and RStudio output for multiple sub-questions, only if the output for each sub- question is fully contained in a single image. a. In her first two years at UMD, Anna enrolled in 15 course credits in Fall 2019, 18 course credits in Spring 2020, 16 course credits in Fall 2020 and 18 course credits in Spring 2021. Write R code to create a vector for Anna's number of course credits in each of the four semesters. It should be a numeric vector with 4 elements. Be sure to give the vector a brief but descriptive name. After creating the vector, use the class command in R to verify the data type of the vector, and use the summary command to summarize the vector. b. In her first two years at UMD, Jordan enrolled in 14 course credits in Fall 2019, 18 course credits in Spring 2020, 15 course credits in Fall 2020 and 16 course credits in Spring 2021. Write R code to create a vector for Jordan's number of course credits in each of the four semesters. It should be a numeric vector with 4 elements. Be sure to give the vector a brief but descriptive name. After creating the vector, use the class command in R to verify the data type of the vector, and use the summary command to summarize the vector. c. Write R code to create a character vector with the names of the four semesters involved in the previous situations. You should use the names "Fall 2019", "Spring 2020", "Fall 2020" and "Spring 2021". After creating the vector, use the summary command to summarize the vector.d. Write R code to use the character vector from the previous question to name the vectors for Anna's course credits and Jordan's course credits. After naming the course credit vectors, recall (or print) the vectors in R by typing the names of the course credit vectors. Be sure to include all output from the RStudio console. e. Write R code to create two variables: one variable that calculates the average of Anna's course credit vector, and one variable that calculates the average of Jordan's course credit vector. Be sure to give each variable a brief but descriptive name. After creating the two variables, recall (or print) the vectors in R by typing the names of the variables. Be sure to include all output from the RStudio console

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Linear Algebra With Applications

Authors: Jeffrey Holt

2nd Edition

1319057691, 9781319057695

More Books

Students also viewed these Mathematics questions

Question

2. Ask questions, listen rather than attempt to persuade.

Answered: 1 week ago