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

By Haktan Suren
Dec 6th, 2015
4 Comments
6940 Views

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.

Package is not available

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.

About the Author

Haktan Suren
- Webguru, Programmer, Web developer, Graduate student & Father :)

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

  1. […] of all, I highly recommend checking my other post if you are getting package ‘xxx’ is not available (for R version x.y.z)” […]

  2. leeza says:

    I am not being able to install plotly package,tried every method u given….what should i do to make it work.

  3. Michael says:

    This was very helpful, thank you!

Wrap your code in <code class="{language}"></code> tags to embed!

Leave a Reply

E-mail address is required for commenting. However, it won't be visible to other users.

Loading Facebook Comments ...
Loading Disqus Comments ...