Sys.setenv("ftp_proxy"="http://fproxy.example.local:4242/")
Sys.setenv("http_proxy"="http://proxy.example.local:4242/")
Note that you might need to issue those commands in a fresh R session, before any install.package() attempt. Then install.package() should work.