Question: USING R Create a function in R that simplifies the calculation of descriptive statistics. The requirements of the function are as follows: The function has

USING R

USING R Create a function in R that simplifies the calculation of

Create a function in R that simplifies the calculation of descriptive statistics. The requirements of the function are as follows: The function has three arguments: - A list of numbers (numeric). A letter (character) A number (numeric) The function behaves as follows o If the letter is 'm', the function prints the arithmetic mean of the list. . If the letter is 'v', the function prints the variance of the list. . If the letter is 's, the function prints the standard deviation of the list. . If the letter is z, the function prints the z-score of num with respect to the list. You can use built-in R functions including mean(), var() and sd(). Here is a starting point for the function: descriptive_function rivers Run the following cases (your output should be the same as the one shown): > descriptive_function(rivers, 'm', 7) [1] 591.1844 > descriptive_function(rivers, 'm') [1] 591.1844

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!