plot() on Function

Q

How to use the plot() function on a function?

✍: FYIcenter.com

A

If you have a known function with a single independent variable, you can pass the data frame as the first argument followed by a starting value and an ending value to the plot function to visualize the function.

Call plot() with the sin() function:

> typeof(sin)
[1] "builtin"

> is.function(sin)
[1] TRUE

> plot(sin, -pi, 2*pi)

The following graphic will be generated:

plot() Function on sin() Function
plot() Function on sin() Function

 

Build Graph Manually

plot() on Data Frame

Built-in Graphics Package in R Environment

⇑⇑ R Software Environment - Frequently Asked Questions

2023-03-17, 298🔥, 0💬