Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.
image text in transcribed

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_2

Step: 3

blur-text-image_3

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

Databases Demystified

Authors: Andrew Oppel

1st Edition

0072253649, 9780072253641

More Books

Students also viewed these Databases questions

Question

Know the three main dimensions of the service environment.

Answered: 1 week ago

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago