My aim is to generate a cumulative distribution function made with steps, using the parameter type="s", but when i try for example
plot(ecdf(rgeom(0:40,0.3)), type="s")
it says the error
Error in plot.default(NA, NA, type = "n", xlim = xlim, ylim = ylim, xlab = xlab, : formal argument "type" matched by multiple actual arguments
What to do?
Instead try:
plot(ecdf(rgeom(0:40,0.3)),verticals = TRUE)
In this case plot dispatches to plot.ecdf which in turn calls plot.stepfun. plot.stepfun initializes a plot using a call to plot() that specifies type = "n", hence the conflict in type arguments.
The verticals argument is from plot.ecdf and so it gets passed along happily without any conflicts.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With