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

```{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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
