I have two rasterbrick objects showing precipitation. Both have longitude and latitude dimensions of 144 x 72. The first (brick1) has 478 monthly time layers (39 years, 10 months) running from Jan 1979 to Oct 2018. The second (brick2) has 12 monthly time layers (Jan through Dec) representing the monthly mean values for 1981-2010. I want to calculate an anomaly by subtracting the geographically appropriate monthly mean from each data point. I did this:
anom <- brick1-brick2
R did not complain - but I am not sure if I got what I wanted.
My hope is that R will subtract the January through December means first against 1979, then it will recycle those means identically through each year until 2018, and in 2018 it will apply only the first 10 means (Jan through October). I have not been able to find any documentation that indicates whether this is the way it is actually done. I have seen some statements to the effect that some operations recycle smaller objects against the larger ones, but nothing specifically about rasterbricks. Does anybody know?