I am a beginner in R. I have six variables in spatial raster datasets for the period of 18 years. I have created six different raster stacks with each stack containing 18 layers. Now I want to calculate a partial correlation between two variables by controlling the other fours. I have developed a pixel to pixel calculation code that works fine for a smaller area. However, my area of study is very big ( approx. 32000000 pixels) and my laptop would take ages to calculate partial correlation using pixel to pixel approach. Is there any other efficient method that could directly incorporate three-dimensional datasets to calculate partial correlation?
Thank you, would love to listen from someone who has expertise.