Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Let x be a numeric vector and suppose you want to know how many entries of x are strictly less than 5 . Create a
Let be a numeric vector and suppose you want to know how many entries of are strictly less than Create a new variable which is equal to the number of entries of that are strictly less than For example, if
then your variable should be equal to Your code for must be expressed in terms of so that for different vectors the same expression for will always give the correct answer. To do that, we create a function counts with input argument Within this function you need to create your variable in terms of so that this function returns the right answer for any numeric vector
Also, within the counts function, create another variable which is equal to the number of entries of that are strictly between and Like the variable must be expressed in terms of so that the same expression for works for various vectors The autograder will test your answer for several vectors
You should have only two lines of code, one for one for Also, there is no partial credit! This is true for each question If one of the vectors or is wrong but the other one correct, you still get pts
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