Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

```{r} # Here's a function skeleton to get you started # Fill me in with an informative comment # describing what the function does trimmedMean

image text in transcribed

```{r} # Here's a function skeleton to get you started # Fill me in with an informative comment # describing what the function does trimmedMean  
 
Problem 5: Let's apply some functions (a) Writing trimmed mean function Write a function that calculates the mean of a numeric vector x, ignoring the s smallest and 1 largest values this is a trimmed mean). E. g., if x = c ( 1 , 7 , 3, 2, 5 , 0 . 5, 9 , 10 ) , s = 1 , and = 2 , your function would return the mean of c(1, 7, 3, 2, 5) (this is x with the 1 smallest value (0.5) and the 2 largest values (9, 10) removed). Your function should use the length() function to check if x has at least s 1 values. If x is shorter than s +1,your function should use the message() function to tell the user that the vector can't be trimmed as requested. If x is at least length s1 1,your function should return the trimmed mean. # Here's a function skeleton to get you started # FII me in with an informative comment # describing what the function does trimmedMean

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

More Books

Students also viewed these Finance questions

Question

=+5. What are the six main categories of nonverbal signals? [LO-5]

Answered: 1 week ago