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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!