gcurve | R Documentation |
A function to exploit base R's curve function. This returns a data.frame holding x and y values returned from a call to curve, but suppress the plotting of that function
gcurve( expr, from = NULL, to = NULL, n = 101, add = FALSE, type = "l", xname = "x", xlab = xname, ylab = NULL, log = NULL, xlim = NULL, category = NULL, ... )
expr |
inherited from curve |
from |
inherited from curve |
to |
the range over which the function will be plotted. |
n |
inherited from curve |
add |
inherited from curve |
type |
inherited from curve |
xname |
inherited from curve |
xlab |
inherited from curve |
ylab |
inherited from curve |
log |
inherited from curve |
xlim |
inherited from curve |
category |
option to add a column populated with a factor (by gcurve) |
... |
inherited from curve |
A data.frame is returned. Columns include x, y, and optionally category.
Greg Cicconetti
graphics::curve
{ require(ggplot2) curve(dnorm(x, mean=0, sd=1), from=-4, to = 4, n= 1001) ggplot(gcurve(expr = dnorm(x, mean=0, sd=1),from=-4, to = 4, n= 1001, category= "Standard Normal"), aes(x=x, y=y)) + geom_line() }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.