Using R software, create a function that returns the square root of a vector x. However, it uses a tryCatch statement so that if x has negative numbers, then it returns x as it is and issues a warning that x contains negative numbers. Otherwise, it returns the square root of x

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter13: Structures
Section: Chapter Questions
Problem 5PP
icon
Related questions
Question
100%

Using R software, create a function that returns the square root of a vector x. However, it uses a tryCatch statement so that if x has negative numbers, then it returns x as it is and issues a warning that x contains negative numbers. Otherwise, it returns the square root of x

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr