Impossible to sum rasters because of nodata pixels

Firstly, you can use gdal_calc.py to change all -9999 to 0 and set the NoData value to 0.

For instance:

gdal_calc.py -A input.tif --outfile=input_with_NoData.tif --calc="A+9999*(A==-9999)" --NoDataValue=0

Then, you can ignore NoData value using gdal_translate with the -a_nodata option followed by none.

-a_nodata value:

Assign a specified nodata value to output bands. Starting with GDAL 1.8.0, can be set to none to avoid setting a nodata value to the output file if one exists for the source file

Example:

gdal_translate -a_nodata none input_with_NoData.tif output_without_NoData.tif

In R:

library(raster)
s <- stack('file1', 'file2', ...)
ss <- sum(s, na.rm=TRUE)