In this exercise, you will work with rivers data. The data pertain to the length of major North American rivers, and it is built-in data in R. You can access the data by typing:
Your task is to build a function that returns descriptive statistics for different inputs. The function is named descriptive_function and has three arguments (i.e., another name of inputs).
descriptive_function(list, char, num)
The requirements of the function are as follows:
· The function has three arguments. The first argument is a list of numbers in doubles. The second argument is a character, and the last argument is a number.
· If char is ‘m ’, the function prints the arithmetic mean of the list.
· If char is ‘v’, the function prints the variance of the list.
· If char is ‘s’, the function prints the standard deviation of the list.
· If char 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().
Sample test cases:
> descriptive_function(rivers, ‘m’, 7)
> descriptive_function(rivers, ‘m’)
> descriptive_function(rivers, ‘s’)
> descriptive_function(rivers, ‘v’, 8)
> descriptive_function(rivers, ‘z’, 8)
Why Choose Us
- 100% non-plagiarized Papers
- 24/7 /365 Service Available
- Affordable Prices
- Any Paper, Urgency, and Subject
- Will complete your papers in 6 hours
- On-time Delivery
- Money-back and Privacy guarantees
- Unlimited Amendments upon request
- Satisfaction guarantee
How it Works
- Click on the “Place Order” tab at the top menu or “Order Now” icon at the bottom and a new page will appear with an order form to be filled.
- Fill in your paper’s requirements in the "PAPER DETAILS" section.
- Fill in your paper’s academic level, deadline, and the required number of pages from the drop-down menus.
- Click “CREATE ACCOUNT & SIGN IN” to enter your registration details and get an account with us for record-keeping and then, click on “PROCEED TO CHECKOUT” at the bottom of the page.
- From there, the payment sections will show, follow the guided payment process and your order will be available for our writing team to work on it.