> On Feb 6, 2016, at 4:11 AM, jupiter <jupiter....@gmail.com> wrote:
> 
> Hi,
> 
> I am just starting to learn R, sorry for asking a simple question. How can
> plot a line x <= 0 y = 0, x > 0 y = 1?

There is a stepfun function and an associated plotting method:

 y0 <- c(rep(0,3),rep(1,3))
 sfun0  <- stepfun(-2:2, y0, right=TRUE)
 plot(sfun0)
 
-- 

David Winsemius
Alameda, CA, USA

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to