From r-help Thu Nov 20 13:43:48 2003 From: "Pascal A. Niklaus" Date: Thu, 20 Nov 2003 13:43:48 +0000 To: r-help Subject: [R] Increment element of vector and efficiency X-MARC-Message: https://marc.info/?l=r-help&m=107151315521721 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