I have been using R Studio for years without any issues but today I am not able to install any packages.
When I use the following code:
install.packages("dplyr")
I just get this message:
Error in install.packages : Line starting '<!DOCTYPE HTML PUBLI ...' is malformed!
I have tried different mirrors and updated my R Studio to the latest version without any joy. My internet connection hasn't changed and is operating normally.
Any help hugely appreciated!
This suggests you are getting an http redirect from the server. Changing the repo ought to fix it. There are many different repos you can try. I find the following very reliable:
install.packages("dplyr", repos = c(CRAN = "https://www.stats.bris.ac.uk/R/"))
EDIT
After some extensive trial-and-error, it looks as though it was the download method used by install.packages that was to blame, so the solution was:
install.packages("dplyr", method = "libcurl")
For me, using type="source" solved. i.e.
install.packages("dplyr", type="source")
Failing that, try downloading Rtools and double clicking on it to install it, close your R session and try again, it should succeed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With