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
Blake BarnesEngineering
(5/5)

565 Answers

Hire Me
expert
Thaissa LannesLaw
(5/5)

624 Answers

Hire Me
expert
Laurence FarrelllPsychology
(5/5)

855 Answers

Hire Me
expert
Hemant Kumar KhatriStatistics
(/5)

562 Answers

Hire Me
R Programming
(5/5)

Write an R code to eliminate the column ID from the Credit data and call the data as CreditCardData.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Q1. Consider the Credit data set from the ISLR package. First, install the package ISLR in RStudio. This data set contains information on ten thousand customers. Look at the data using View(Credit). Notice that the first column is just the customer ID. We don’t really want to treat this as a variable.

(a) Write an R code to eliminate the column ID from the Credit data and call the data as CreditCardData. Also write an R code to identify which variables are numeric in the credit card data. Also write an R code to find the standard deviation of all the numeric variables in the CreditCardData set. Print all the output (8 Marks)

(b) Write an R code to find the total number of customers whose credit card balance is between $68 and $863 (inclusive) in the CreditCardData. Also write an R code to find the location of the maximum value in Balance variable in CreditCardData data set. Print all the output. (2+2 Marks)

(c) Write an R code to create a subset of CreditCardData for all female customers who are not students and call these data set as newdata. Also write an R code to find the average income of female customers who are not students. Print the output (8 Marks)

(d) What type of graph can be used to compare the credit card balance of the customers across different ethnicity of customers. Write an R code to draw the graph and compare the results based on the graph. Print all the output and include your graph. (10 Marks)

Q2. The studentdata.txt uploaded in eLC. Import this data in R using the function read.table() and header=TRUE and store it as newdata. This data was collected based on sheet of questions answered by a large number of students in introductory statistics classes. The variable information is given below:

Student: student number Height: height in inches Gender: gender

Shoes: number of pairs of shoes owned Number: number chosen between 1 and 10 Dvds: name of movie dvds owned

ToSleep: time the person went to sleep the previous night (hours past midnight)

WakeUp: time the person woke up the next morning

Haircut: cost of last haircut including tip

Job: number of hours working on a job per week

Drink: usual drink at suppertime among milk, water, and pop

(a) Write an R code to determine the total number of missing values for the variable Height. (4 Marks)

(b) Write an R code to create a new column and call it hours.of.sleep from the dataframe newdata by calculating the number of hours the students slept last night. Also write an R code to find the average number of hours students slept last night. Also write an R code to find the distribution of hours.of.sleep by using a suitable graph and comment on the shape of the distribution. Include the graph in your answer. (3+3+5 Marks)

(c) Do men tend to sleep longer than women? What type of graph can you use to answer this question. Write an R code to draw a suitable graph in R and comment on the center, shape and spread of the distribution of hours.of.sleep for male and female. Include the graph in your answer. (10 Marks)

(d) Find the average haircut prices for male and female students. Compare the average haircut prices for males and females and comment. Print the output. (5 Marks)

(e) Use the table () command in R to construct a frequency table of the individual values of Drink that were observed. Also create a barplot in R and find out what type of Drink is most preferable to students. (10 Marks)

Q3. Suppose that your data is saved as a csv file (csv stand for comma-separated values). We need to read the data into R. Consider an experiment where girth, height and volume has been measured for 31 cherry trees. The data are uploaded in the file cherry.csv in eLC and store the data set as cherrydata.

(a) From the cherrydata data frame, write an R code to create a subset of the data set of the cherry trees whose Height is greater than 70 and Girth is greater than 15 and call it Subdata. Also write an R code to find the interquartile range of the variables Girth, Height, and Volume from Subdata. (10 Marks)

(b) Write an R program to draw a histogram of the Volume of cherry trees. Discuss about the shape of the histogram. What is the most appropriate measure to describe the typical volume of cherry trees? Use R to compute this value. (10 Marks)

(c) Assume that the data from two more trees are available with Girth= (11.5, 17.0), Height= (71, 75), Volume= (22, 40) respectively. Write an R code to create a data frame with this new data value and call it as df. Merge the data set with cherrydata data set and name it as fulldata. (10 Marks)

(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