On Fri, Jun 18, 2010 at 8:15 PM, Horace Tso <horace....@pgn.com> wrote: ... >> which(x<-2) > Error in which(x <- 2) : argument to 'which' is not logical > > Oops, what happened? If you look up help pages for 'which', you'd find no > clue. You just have to look at the error message. R adds the spaces and you see immediately why it interpreted the code wrongly.
I do like readable code though. "<-" and spaces add a bit in writing time, but save a whole bunch in debugging time. Especially a couple of weeks after you wrote the code. And I'm not exactly an S old-timer. This even comes from somebody who loves Perl ;-) . Cheers Joris -- Joris Meys Statistical consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control tel : +32 9 264 59 87 joris.m...@ugent.be ------------------------------- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php ______________________________________________ R-help@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.