<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>Thanks for all the replies. In case anyone is interested, I asked the same question on stackexchange and got the following answer:<br/>
<br/>
library(dplyr)<br/>
cel <- data_frame(cell = vec)<br/>
tab <- cel %>% group_by(cell) %>% summarize(val = n())<br/>
## update your raster<br/>
r[tab$cell] <- tab$val<br/>
<br/>
I will try the soultions you guys suggested as well, thanks a lot again !<br/>
Best,<br/>
Giacomo</div></div></body></html>