[prev in list] [next in list] [prev in thread] [next in thread]
List: r-help
Subject: [R] Increment element of vector and efficiency
From: "Pascal A. Niklaus" <Pascal.Niklaus () unibas ! ch>
Date: 2003-11-20 13:43:48
[Download RAW message or body]
Hi all,
Thanks for the incredibly quick help with the "%in%"...
There's a second question, though: I'd like to increment an element of a
vector if a certain event occurs, e.g.
count[event] <- count[event] + 1; # works, but...
Is this efficient? I wonder whether R needs to subset the count vector
on both sides of the assignment operator (i.e., twice), or whether
there's a shortcut like "++" in C, e.g. "count[i]++" or similar?
Pascal
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic