Question: Solve using R programming please. **Using dataset airquality in R** 1.) Write a function that takes on of the column names of the data frame
Solve using R programming please.
**Using dataset airquality in R**
1.) Write a function that takes on of the column names of the data frame as input, and then standardizes that variable and makes it a new variable in the data frame. Recall that standardizing a variable involves subtracting each observation from the mean and dividing the result by the standard deviation.
For example, if the input were Ozone, you want the function to create a new variable in the dataframe that contains the standardized Ozone values.
2.
Consider the following vector, which represents radii of various circles. Write a function that computes the circumference and area of the corresponding circle. Design a way to return the results neatly.
```{r} radii <- c(2.73, 8.14, 3, 3.2, 5.7, 9.9, 1.2, 8.3, 4.3, 5.7)
3.
A European call option is a type of financial derivative that allows the buyer to purchase the stock at a pre-established price, called the strike price, on a certain date.
For example, if one buys a European call option (assume no transaction costs) with strike price \$5, then it would make sense to exercise the call option so long as the stock price is above \$5. Say the stock price is \$10. Then, you can exercise your call option, buy for \$5, and sell for \$10, netting you a profit of \$5. However, if the stock price is below \$5, you would not exercise your call option, as it would not make sense to buy the stock for a higher price than what it is worth.
Write a function that tells you whether or not you should exercise your call option. If you should not exercise the option, have the function output a text string that tells you not to exercise. If you should exercise the option, have the function tell you to exercise and tell you what your profit will be. The function should have the following inputs: strike price and stock price.
After you write the function, test the following inputs: (strike price = 10, stock price = 20), (strike price = 10, stock price = 8), (strike price = 10, stock price = 10), (strike price = 30, stock price = 31).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
