Question
Assignment 1: R Programming Please save your R code in a text file R programming requires very minimum of coding once you are familiar with
Assignment 1: R Programming
Please save your R code in a text file
R programming requires very minimum of coding once you are familiar with the syntax. Try to avoid writing lengthy and unnecessary code. Please check lecture notes and online resources. Problem 1. Create two vectors named v and w with the following contents:
v : 2,3,4,5,6,7,4,2
w : 9,10,2,34,5,18,9,2
A) Print the length of the vectors
B) Print all elements of the vectors
C) Print elements at indicies 2 through 4.
D) Print the sum of the elements in each vector.
E) Find the mean of each vector. (Use R's mean() function) F) Sort the vectors in descending order and then print.
G) Add vectors v and w. H) Multiply vectors v and w. I) In vector v select all elements that are greater than 2. J) In vector w select all elements that are less than 20. K) Multiply each element of vector v by 6.And then print. L) Find maximum and minimum of each vector. M) In each vector, replace all elements with value of 2 by 80.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started