Site icon Haktan Suren, PhD

Installing R package: Fixing package ‘xxx’ is not available (for R version x.y.z)” warning?

The default version of `install.packages` somehow stopped working for me on latest version of R. In fact this is regardless of the version of R. I remember having same problem with the older versions of R as well.

Here is the screen shot of the warning. if you are having similar problem, keep on reading.

Anyways, long story short, as everyone knows, if you want to install a package on R, you use:

install.packages('package-name')

And it asks you to pick a mirror repository to search the package in. If you are like me, picking the Cloud, you will soon realize, it will give you a misleading warning that the package is not available for your installed version of R. Well, this is not entirely true based on my experience.

I think not all the repositories include same packages (or versions) for some reason, that’s something I need to confirm it with R support team. If you select different mirror from previous step, and you are lucky enough, you might be able to install the package without any further problem/headache.

I usually use the following code to install package from R and it works 99% of the time.

install.packages('package-name',repos='http://cran.us.r-project.org')

There are several mirrors available you can try, simply change the repos field on the code above. Find the list of the mirrors here.

You still have problem installing the R package? See my other post here.

Feel free to share your experience, or the mirror works for you the best commenting below.

Exit mobile version