Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Databases With PostgreSQL From Novice To Professional

Authors: Richard Stones, Neil Matthew

2nd Edition

1590594789, 978-1590594780

More Books

Students also viewed these Databases questions

Question

List out some inventory management techniques.

Answered: 1 week ago

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago