Question: 1 . From ISLR obtain the Caravan data. Please answer the following questions based on this dataset. Here is what the dataset is: table

1. From ISLR obtain the Caravan data. Please answer the following questions based on this dataset. Here is what the dataset is:
\table[[4,A,B,C,D],[1,Name,Age,Weight,Height],[2,A,1,2,4],[3,B,2,2,2],[4,C,2,4,6.2],[5,D,22,4,6],[6,E,19,185,5.9],[7,T,5,6,7],[8,K,56,76,78],[9,U,7666,8,7]]
a) Name Caravan data as temp1.
b) Find the dimension of Caravan data.
c) Find column names of Caravan data.
d) Find the rows of the Caravan where the Purchase column shows Yes.
e) Find the rows of the Caravan where the Purchase column shows No and the MOSTYPE value isless than 25.
f) Obtain the subset of the Caravan data where the column names include M.
g) Obtain the subset of the Caravan data where the column names start with M.Hint: For this problem, you can use, dplyr library and the following code below.select(temp1,starts_with("M"))
2. For this question, you need to use airquality data. You can access this data from R without anylibrary. This data includes some missing values which are shown as NA in the data set.
a) Find total number of missing values.
b) Find how many missing values are in each column.
c) Delete the rows which contains missing data.
d) Find the rows where Solar.R column includes missing values and remove these rows.
e) Find the rows where Ozone column includes missing values and remove these rows.
f) Find the rows where Solar.R and Ozone columns include missing values and remove these rows.
g) Find the rows where Solar.R or Ozone columns include missing values and remove these rows.
3.Gaussian random numbers. One way to generate a random number taken from the Gaussian distribution is to use the Box-Muller formula:
Z=sin(2v)(-2lnu)12
where u and v are real numbers between 0 and 1 generated by runif(1,0,1)function. Compose a program that writes a standard Gaussian random variable. And calculate Z value.

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!