If your internet connection is behind a proxy server, then you have to configure your proxy settings with httr before using install.packages()
library(httr)
set_config(
use_proxy(url="your.proxy.ip", port="port", username="user",password="password")
)