The command is type = "l" not "lines"....
If you want linear interpolation (which may or may not be the right
thing for an ecdf), you'll have to do a bit more work since you aren't
passing plot a set of points.
x <- ecdf(rnorm(500))
I've packaged it all up in a function for you because it requires some
trickery:
plotECDFLinearInterp <- function(e, type = c("l", "s"),
...){
stopifnot(inherits(e, "ecdf"))
x <- environment(e)$x
y <- environment(e)$y
plot(x,y, type = match.arg(type), ...)
invisible(e)
}
Note that you may wish to change the type to "s" or "S" to
get a step
function (arguably also the right interpolation for an ECDF)
Michael
On Sat, Mar 24, 2012 at 6:56 AM, Alaios <alaios at yahoo.com>
wrote:> Dear all,
> I would like to print an empirical cdf on a vector I have
> while the plot(ecdf(myVector)) works great when I try to specify the line
type to be a line (I get points) with
>
> plot(ecdf(myVector),type="lines")
> Error in plot.default(NA, NA, type = "n", xlim = xlim, ylim =
ylim, xlab = xlab,? :
> ? formal argument "type" matched by multiple actual arguments
>
> I get this error message.
>
> Why this happens and how should I next time interpret the error massage?
>
> Regards
>
> ? ? ? ?[[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>