Ted: Inline below...
On Tue, Dec 7, 2010 at 8:42 AM, Ted Harding <ted.hard...@wlandres.net> wrote: > Indeed! > > x <- x + 1 > > (and being generous with unnecessary spaces) uses 10 characters. > > `+`(x)<-1 > > (being mean with them) uses 9. The "mean" version of the first > uses only 6: x<-x+1 > > However, I suppose there is merit in the spiritual exercise > of contemplating how `+`(x)<-1 gets worked out! AFAICS it doesn't. > `+`(x)<-1 Error in +x <- 1 : could not find function "+<-" `+`(x,1) does: > `+`(x,1) [1] 4 -- Bert > > Ted. > > On 07-Dec-10 16:23:17, Ivan Calandra wrote: >> x+1 is not that complicated... Am I missing something here? >> >> Le 12/7/2010 16:55, Gabor Grothendieck a écrit : >>> On Tue, Dec 7, 2010 at 8:43 AM, madr<madra...@interia.pl> wrote: >>>> many languages have shorthands for that operation like: >>>> >>>> variable += 1 >>>> or >>>> ++variable >>>> >>>> is there something like that in R ? >>> >>> You can do this: >>> >>>> x<- 3 >>>> `+`(x)<- 1 >>>> x >>> [1] 4 >> -- >> Ivan CALANDRA > > -------------------------------------------------------------------- > E-Mail: (Ted Harding) <ted.hard...@wlandres.net> > Fax-to-email: +44 (0)870 094 0861 > Date: 07-Dec-10 Time: 16:42:44 > ------------------------------ XFMail ------------------------------ > > ______________________________________________ > 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. > -- Bert Gunter Genentech Nonclinical Biostatistics ______________________________________________ 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.