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 HW which has many columns including two that are named
and 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 by the corresponding row entry in
b Print the relative standing see earlier lecture for formula of each
observation in B treating it as a population
c Create an new objectvector call it whatever you want that contains the
last 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
row
Hint: We did something similar when creating returns.
Hint: You can create a dataset using the following code to test out your answers:
MYDATAdata. frame
Note: You are being asked for the code in this problem, not the output.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
