Thanks @coatless . Sounds good. @sw123 apparently you need CXX14FLAGS += -isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include instead of CXX14FALGS += -isystem /usr/include in ~/.R/Makevars .
You may also need that line in CXXFLAGS and CXX11FLAGS for other packages that use C++.