<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>
<div>Hi Ben,</div>

<div>I am happy if I can be of help. So I have tried the two suggestions (one from stackexchange, which i provided, and one from the mailing list, from Loic to be exact) and the only one working properly was the one from stackexchange. it was very fast, it took 1 second max. If you want me to try anything else out for you just let me know.</div>

<div>best,</div>

<div>Giacomo</div>

<div> 
<div style="margin: 10.0px 5.0px 5.0px 10.0px;padding: 10.0px 0 10.0px 10.0px;border-left: 2.0px solid rgb(195,217,229);">
<div style="margin: 0 0 10.0px 0;"><b>Gesendet:</b> Montag, 11. Juli 2016 um 18:33 Uhr<br/>
<b>Von:</b> "Ben Tupper" <btupper@bigelow.org><br/>
<b>An:</b> "Giacomo May" <Giacomo_May94@gmx.de><br/>
<b>Cc:</b> r-sig-geo@r-project.org<br/>
<b>Betreff:</b> Re: [R-sig-Geo] Add +1 to current value of a cell in a raster in R</div>

<div>
<div>Hi Giacomo,
<div> </div>

<div>I am interested to know which you find fastest - perhaps you could let us know some timing results?</div>

<div> </div>

<div>Thanks,</div>

<div>Ben</div>

<div> </div>

<div>
<div>
<blockquote>
<div>On Jul 11, 2016, at 12:21 PM, Giacomo May <<a>Giacomo_May94@gmx.de</a>> wrote:</div>
 

<div>
<div>
<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>
</div>
_______________________________________________<br/>
R-sig-Geo mailing list<br/>
<a>R-sig-Geo@r-project.org</a><br/>
<a href="https://stat.ethz.ch/mailman/listinfo/r-sig-geo" target="_blank">https://stat.ethz.ch/mailman/listinfo/r-sig-geo</a></div>
</blockquote>
</div>
</div>
 

<div>
<div style="text-indent: 0.0px;">
<div>
<div>
<div>
<div>
<div>
<div>
<div style="color: rgb(0,0,0);font-family: Monaco;font-style: normal;font-weight: normal;letter-spacing: normal;text-transform: none;white-space: normal;word-spacing: 0.0px;font-size: 13.0px;"><font class="Apple-style-span" face="Helvetica">Ben Tupper<br/>
Bigelow Laboratory for Ocean Sciences<br/>
60 Bigelow Drive, P.O. Box 380<br/>
East Boothbay, Maine 04544<br/>
<a href="http://www.bigelow.org" target="_blank">http://www.bigelow.org</a></font></div>

<div style="color: rgb(0,0,0);font-family: Monaco;font-style: normal;font-weight: normal;letter-spacing: normal;text-transform: none;white-space: normal;word-spacing: 0.0px;font-size: 13.0px;"> </div>

<div><font face="Helvetica" size="2">Report Gulf of Maine jellyfish sightings to <a>jellyfish@bigelow.org</a> or tweet them to #MaineJellies -- include date, time, and location, as well as any descriptive information such as size or type.  Learn more at <a href="https://www.bigelow.org/research/srs/nick-record/nick-record-laboratory/mainejellies/" target="_blank">https://www.bigelow.org/research/srs/nick-record/nick-record-laboratory/mainejellies/</a></font></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div></div></body></html>