[r] Check for installed packages before running install.packages()