Question: Please help using R , thank you The function `sqrt()` provides the square root of any number. However, it can't provide any square root of
Please help using R , thank you
The function `sqrt()` provides the square root of any number. However, it can't provide any square root of negative number. We want to create our own function to provide a message for negative number. a) Create a new `R` function `getRoot()` that will provide square root of any number. If the number is negative it should return 'not possible'. Demonstrate your function such that it produces the following outputs. `getRoot(4) = 2, getRoot(-4) = 'not possible'` b) Does your function produce expected results for vector input as well? For example does it give the following result? Explain why or why not. `getRoot(c(4,-4, 9, -16))=2 'not possible' 3 'not possible'` c) If your function does not work as expected, how can you make it work properly?
Please help using R , thank you
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
