Answered step by step
Verified Expert Solution
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
```{r} # Here's a function skeleton to get you started # Fill me in with an informative comment # describing what the function does trimmedMeanProblem 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
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