I have been attempting to load the R package rgdal because it is required for a number of spatial packages I need to use. For days I have tried to troubleshoot the below error message but virtually every forum related to such error delves into highly technical coding and I have reached wits end in trying to understand how to solve the issue. I have installed rgdal in R with no errors but when I call up the package from the library, I get the following error:
> library(rgdal)
Error: package or namespace load failed for ‘rgdal’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Library/Frameworks/R.framework/Versions/4.2/Resources/library/rgdal/libs/rgdal.so':
dlopen(/Library/Frameworks/R.framework/Versions/4.2/Resources/library/rgdal/libs/rgdal.so, 0x0006): tried: '/Library/Frameworks/R.framework/Versions/4.2/Resources/library/rgdal/libs/rgdal.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/R.framework/Versions/4.2/Resources/library/rgdal/libs/rgdal.so' (no such file), '/Library/Frameworks/R.framework/Versions/4.2/Resources/library/rgdal/libs/rgdal.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))
In addition: Warning message:
package ‘rgdal’ was built under R version 4.3.0
I have Homebrew installed on my Mac and have gone through many steps to try to fix this architecture issue but no recommended steps have worked, such as uninstalling and reinstalling things in the terminal. Please can someone simply explain what this error means and what I need to do to resolve it.