Question: MLB_teams from the mdsr package Write a function called mystats that takes a single input (a variable from a dataset or a vector of values)
MLB_teams from the mdsr package

Write a function called mystats that takes a single input (a variable from a dataset or a vector of values) and outputs summary statistics for the variable, including mean, standard deviation, and the five number summary. You are welcome to use R's built in functions to compute the statistics. Create a print method to make the output appear as follows when applied to the variable payroll from the MLB_teams data: mystats (MLB_teams$payroll) ## Summary Statistics for MLB_teams$payroll: ## mean = 94365324, sd = 40266547 ## Five number summary: ## min = 17890700, Q1 = 67325266, median = 85803967, Q3 = 114741109, max = 231978886 But how do I get the variable name in the output?? Getting the output to include the name of the variable that was input into the function is a bit tricky. Below is a simple function (which I'll call give_me_the_name) that just gives back the name of the variable that was input. give_me_the_name
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
