How to avoid “cannot find -lR” for R Package installation on windows

I want to install packages from source: Setting up the environmental variables: Sys.setenv(BINPREF = “C:/PROGRA~1/R/Rtools/mingw_64/bin/”) Sys.setenv(BINPREF64 = “C:/PROGRA~1/R/Rtools/mingw_64/bin/”) Sys.setenv(PATH = “C:/PROGRA~1/R/R-3.4.2/bin/x64/;C:/PROGRA~1/R/Rtools/bin/;C:/PROGRA~1/R/Rtools/mingw_64/bin/”) Installing any package from source results in “cannot find -lR” error: install.packages(“later”) Error message: C:/PROGRA~1/R/Rtools/mingw_64/bin/g++ -shared -s -static-libgcc -o later.dll tmp.def RcppExports.o callback_registry.o debug.o init.o later.o later_posix.o later_win32.o timer_posix.o timestamp_unix.o timestamp_win32.o tinycthread.o -Ld:/Compiler/gcc-4.9.3/local330/lib/i386 -Ld:/Compiler/gcc-4.9.3/local330/lib…

Details