Question: Consider the dataset HW 2 which has many columns including two that are named ' A ' and ' B ' consisting of numeric values

Consider the dataset HW2 which has many columns including two that are named
'A' and 'B' consisting of numeric values that has been loaded into Rstudio.
Specify Rstudio code (one line) which could be used to accomplish the following:
a. Multiply every entry of B by the corresponding row entry in A.
b. Print the relative standing (see earlier lecture for formula) of each
observation in B (treating it as a population).
c. Create an new object/vector (call it whatever you want) that contains the
last 5 values in B.
d. Create a new object called "ColVariances" which is a vector which contains
the (sample) variances of each column A and B.
Hint: You know how to create objects. You know how to compute the
variances of each column. You know how to merge two numbers (in this
case the columns means).
e. Create a for() loop that outputs a vector containing the products of every
entry in column A with the preceding entry in column A (starting from the
2nd row).
Hint: We did something similar when creating returns.
Hint: You can create a dataset using the following code to test out your answers:
MYDATA=data. frame (A=c(1,3,2,4,5),B=c(5,10,20,15,25))
Note: You are being asked for the code in this problem, not the output.
 Consider the dataset HW2 which has many columns including two that

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!