Question: 1. Please write the following R program given in the format below. Also, please answer all questions and share your code. 2. Also, show all

1. Please write the following R program given in the format below. Also, please answer all questions and share your code.

2. Also, show all outputs. Use R studio

R- Prorgram:

---------------------------------------------------------------------------------------------------

output: word_document: default pdf_document: default ---

```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ```

## Efficiency

a. Install and load the `multcomp` package, to allow testing for statistically significant differences in function timings. ```{r}

```

Load other necessary packages here. ```{r}

```

In this problem, you will work with the cleaned version of the US News and World Report data on colleges and universities, which you created in Homework 9.

b. Read the data into R.

```{r}

``` Use the following code to change spaces in column names into underscores (_). Change the name of the data frame to match what you called the data frame when you read it into R. ```{r} names(usnews) = make.names(names(usnews)) ```

Write a function using a method of your choice to determine how many schools have a per-student instructional expenditure (`Instructional.expenditure.per.student`) higher than their out-of-state tuition (`Out.of.state.tuition`). - Your function for this part of the problem should not use control flow. - Functions from `dplyr` may be useful here. - Alternatively, the built-in functions `length` and `which` may be useful.

```{r}

```

Run the function.

```{r}

```

c. Write a function using control flow to determine how many schools have a per-student instructional expenditure higher than their out-of-state tuition.

```{r}

```

Run the function and check that you get the same answer as in part b.

```{r}

```

d. Use `microbenchmark` to compare the running times of the two methods you wrote in parts b and c.

```{r}

```

- **Write 1-2 sentences** answering the following: Is there a significant difference in the running times of the two methods? If so, which is more efficient?

e. Make a boxplot showing the timing comparison of the two methods. ```{r}

```

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!