Question
What is the R code for below? Write a simple R function named circle.area() that takes a parameter d, which is the circles diameter, and
What is the R code for below?
Write a simple R function named circle.area() that takes a parameter d, which is the circles diameter, and returns the area of the corresponding circle. Note R has a number of embedded constants, such as pi, which is the well-known geometric constant. The area of a circle of diamter d is pi*d^2/4. Create a function to compute and return the area of a circle of diameter d. Close the function bracket and in the next line store a diamater value of 5 in a variable named d. Then, use the function paste() to output this result: "The area of a circle of diameter, d, is area.circle(d)**. Note: in some R routines, paste() will compute a value, but will not display a result (and sometimes it does). To ensure your results are printed, enclose everything in the paste() function within the print() function
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