Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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_nameStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started