logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Woodrow BinionAccounting
(5/5)

705 Answers

Hire Me
expert
Ritesh GrewalBusiness
(5/5)

743 Answers

Hire Me
expert
Kenneth AyotteMarketing
(5/5)

545 Answers

Hire Me
expert
Herman BerensLaw
(5/5)

539 Answers

Hire Me
R Programming
(5/5)

In this problem you will read in a data set, get the structure of the data set, and then perform basic arithmetic on the elements of the data set.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Exercises:

1. In this problem you will read in a data set, get the structure of the data set, and then perform basic arithmetic on the elements of the data set. You will also have to deal with missing values.

(a) Read in the data set called FinalData.csv. How many observations do we have? How many variables? What are the names of the variables? Are they categorical or quantitative?

(b) Add up the values of the fourth row and first column and the twelfth row and third column.

(c) Print the first ten values in the second column.

(d) Find the mean of all the non-missing values in the third column.

(e) Find the proportion of observations that fall in each category for variable y.

2. In this problem we will write a function that contains an if/else statement and a for loop. Then we will use the apply( ) function to run this created function on all the numeric columns in the above data set.

(a) Create a function that reads in a vector of numeric values. In this function, you will loop through all the elements of the vector. You must use a for loop! For each element:

• If that element is missing, then set it equal to zero;

• If that element is negative, then multiply the value by -1;

• If that element is non-negative, then add two to the value. Then, sum up all of the new values and return this sum.

(b) Use the apply( ) to run this new function on all numeric variables in the above data set.

(c) Use only the ifelse( ) and sum( ) functions to get the same results as the previous step. In other words, remove the for loop and function part of this problem.

3. This problem will use functions from the tidyverse package to manipulate data sets and create scatterplots.

(a) Load the tidyverse package into R.

(b) Use the pipe command or create intermediary objects to do the following:

i. Use mutate( ) function to create a new variable that computes the difference between values in column three and column one;

ii. Use the filter( ) function to only include observations that got values equal to B or

C for variable y (remove any observations that got value A for variable y);

iii. Use the group by( ) and summarize( ) functions to get the mean difference from the first step for each of the remaining values in y;

iv. Arrange them from largest to smallest.

(c) Use the ggplot( ) function to create a scatterplot with x as the explanatory variable (horizontal axis) and var.1 as the response variable (vertical axis). Make observations with different values of y different colors in the scatterplot. Add the best fitting curve for each of the different values of y.

(5/5)
Attachments:

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme