recdf

ECDF Function seems to be broken in R


Code and Image

I am working on a problem which requires I create an ECDF from data. All was working well, and then it seems that all of a sudden my ECDF function started returning nonsense. To prove this I wrote the following lines of code:

set.seed(19191)
x <- rnorm(50)
x; ecdf(x)
plot(ecdf(x))

when I run these lines, I get what seems to be nonsense, as shown in the image I attached. This example is from this link: https://statisticsglobe.com/empirical-cumulative-distribution-function-ecdf-r

Can anyone help me?


Solution

  • When I ran the same code in R it worked, so I realized it was an issue with RStudio. After updating RStudio, everything worked perfectly.