[R] increase or decrease variable by 1

Gabor Grothendieck ggrothendieck at gmail.com
Tue Dec 7 16:55:30 CET 2010


On Tue, Dec 7, 2010 at 8:43 AM, madr <madrazel at 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



-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-help mailing list