Update a package and keep it from reverting to the original - r

I want to upgrade the package ggplot2:
library(ggplot2)
packageDescription("ggplot2")["Version"]
> 0.8.3
But the current version is 0.8.7.
I tried update.packages(), which seemed to work OK. But it still returned older version 0.8.3.
So I downloaded and installed the package source from Cran, which says 0.8.7 in the download page.
I then install it via the GUI menu in R. It returns
** building package indices ...
* DONE (ggplot2)
I then run:
packageDescription("ggplot2")["Version"]
> 0.8.3
And still I have the older version!
I don't know why this is not working, what's more I had already come across this problem before and solved it (I can't remember exactly what) but now it has gone back to the older version! What's the easiest way to keep packages like this updated automatically and not have them refer back to older packages?

What version of R are you using? CRAN binaries are only kept up-to-date for the latest R release (i.e. 2.10.1). If you have an older version of R and have the development tools installed, you can use install.packages("ggplot2",type="source").

Did you do unloadNamespace('ggplot2')? and the library(ggplot2) and then check the version? Because, once you load a package, it stays in memory of R, even though you might have already installed a newer version of the package, R does not see, until you do the above.

Related

Installing package webr failed

I am having issues installing the 'webr' package in R, which is necessary to use the PieDonut function to make beautiful multi-level pie charts.
I have followed the instructions on this website, which demonstrates how to install the packages and work with it. https://rpubs.com/cardiomoon/398623
However, when installing the package 'webr' it says:
Failed to install 'webr' from GitHub:
(converted from warning) package ‘mnormt’ is not available (for R version 3.6.2)
It is necessary to install it from GitHub because the CRAN version does not include the PieDonut function.
I already tried to search for older versions of the package and made sure that my R version was up to date, however this did not result in any progress.
Does anybody have any suggestions to help me use this package?
You are on R 3.6.2, whereas mnormt requires R 4.0.0 or higher.
Installing an older version of the package can go from easy to "I want to jump out the window" difficult. If you go to the package archive you can find a version that will not depend on newer version of R than you have. You can install it from source with, if I remember correctly, something along the lines of
install.packages("https://cran.r-project.org/src/contrib/Archive/mnormt/mnormt_1.5-7.tar.gz",
repos = NULL,
type = "source")
Assuming all its dependencies do not require something you do not have (i.e. R >= 4.0.0), it should work. If not, you would have to install mnormt dependecies by hand as well, as well as any potential dependencies of dependencies. See what I mean by jumping out of the window?
Alternatively, upgrade your R and you avoid these kinds of problems (in 99.9 % of the time).

Why is R unable to access index for repository of bioconductor

When trying to install bioconductor (for installing phyloseq package) I get several warning and error messages
I got a new harddrive few days ago so I had to reinstall all programs including R with all the packages I usally need. Everything worked fine until I tried bioconductor.
I am using the rcommended code which worked out for me before:
source('http://bioconductor.org/biocLite.R')
biocLite('phyloseq')
The error message I get is:
Using Bioconductor 3.7 (BiocInstaller 1.30.0), R 3.6.0 (2019-04-26).
installation path not writeable, unable to update packages: cluster,
nlme Updating packages 'bipartite' Warning: unable to access index for
repository
https://bioconductor.org/packages/3.7/bioc/bin/windows/contrib/3.6:
cannot open URL
'https://bioconductor.org/packages/3.7/bioc/bin/windows/contrib/3.6/PACKAGES
So apparently there are several problems?
Some packages cant be updated due to wrong libpath and
R is not able the open the bioconductor hompage
Thanks for your suggestions!
Bioconductor is tied to particular versions of R. You're trying to use a version of Bioconductor (3.7) on a version of R (3.6) that does not match. There is a map between versions, but the underlying problem is that you're using your R-3.5 libraries hoping that they'll work in R-3.6. You should instead 'start over' with an R-3.6 specific installation. In addition, 'BiocInstaller' has been replaced with BiocManager; your 'recommended code' is out of date, as shown on package landing pages.
If you want to continue using your previous library installation (note that this is a one-way street -- you're giving up on your usable R-3.5 installation), try removing ALL versions of the BiocVersion and BiocInstaller packages. .
remove.packages(c("BiocVersion", "BiocInstaller")) # repeat 'till all removed
Either starting with a new library or after removing previous versions of BiocVersion / BiocInstaller, install BiocManager from CRAN
install.packages("BiocManager")
and go about your business
BiocManager::install("phyloseq")
Make sure to validate your installation, so that you do not mix packages from different Bioconductor versions
BiocManager::valid()
Check out current package landing pages, e.g., for phyloseq, or the installation page.

R package listed on CRAN but not in available package

I want to install a package that is listed in https://cran.r-project.org/web/packages/available_packages_by_name.html as available in CRAN, but when I check in R the install packages menu or the available.packages() command, I can't see the package there.
Do I need to do something different to install those packages? Why aren't those packages available?
The packages I'm interested on are WikipediR ( https://cran.r-project.org/web/packages/WikipediR/index.html ), WikidataR and WikipediaR.
If it matters, I'm using R 2.15.0 in Windows XP.
See the documentation for ?available.packages...
By default, the return value includes only packages whose version and
OS requirements are met by the running version of R, and only gives
information on the latest versions of packages.
In other words... your R 2.15 is likely too old for the package you are looking to download.
You can try to download the package source manually add the package to the package library usually found somewhere like "win-library/2.15/" but like Cory mentioned it is likely that the older version of R does not support the package build.
The advice given so far is a bit incomplete although I do agree you need to update your R version if you want to use these packages. Looks like they don't need compilation so you might have been able to either install from a local copy or drop R code in, but critically they depend on httr which requires R 3.0.0 or above. They were released only relatively recently, so there will be no Windows binaries from back in 2012. (Your copy of R is from 30-Mar-2012.) Look in the DESCRIPTION file which is presented in a nice web format at the CRAN/package listing:
https://cran.r-project.org/web/packages/WikidataR/index.html
Imports: httr, jsonlite, WikipediR
Suggests: testthat, knitr, pageviews
# only one version of these two
https://cran.r-project.org/src/contrib/Archive/WikidataR/WikidataR_1.0.0.tar.gz
https://cran.r-project.org/src/contrib/Archive/WikipediaR/WikipediaR_1.0.tar.gz
# pick one of these
https://cran.r-project.org/src/contrib/Archive/WikipediR/

R packages built under r-devel version?

I was loading AIMS package and got a warning:
package ‘AIMS’ was built under R version 3.2.0
I thought R-3.1.2 ("Pumpkin Helmet") was the latest release so I checked on CRAN and couldn't see anything about a R-3.2.0.
Before calling it a typo, I googled the "problem" with different keywords and ended on this page from r-project site mentioning two R versions running, a R-release (R-3.1.2) and a "R-devel, to be R-3.2.0".
Googling "r_devel" confirmed what I was guessing, that this is the current development version.
I'm a bit surprised that packages can be built under the development version and I have a twofold question:
- How can a package already be built under a "to be released" R version and is it "safe"?
- Given that the development version is not released yet, how could I use the package with the R version it was built under? (Having a previous R version doesn't prevent me from using the package but I'm not sure I feel comfortable about the warning...)
Or maybe it was really just a typo?...

Error in loading evd package in R

I'm having problems loading the evd package in R v2.12.0. It worked fine in previous versions.
On the 32bit I get the following message:
Error: package 'evd' is not installed for 'arch=i386'
and with 64bit:
Error: package 'evd' is not installed for 'arch=x64'
There are no updates to the package (last release 2008). I've also tried reinstalling the package from the tar.gz but with no joy.
Any help gratefully received!
I have just installed and loaded evd from CRAN without any problems. I use R2.13.0 on Windows 7 (64-bit).
To install the package directly from CRAN, use:
install.packages("evd")
Then to load it:
library(evd)
I had this problem with many packages when I upgraded to 2.12.2 from 2.11.0. I copied the library from the old installation into the new one. I presume to problem is due to a change in the way packages are structured. To solve it I just reinstalled everything from CRAN:
install.packages(.packages(all.available=T))
R2.12.0 was changed to make it easier to run R on multiple architectures on the same machine (for example, running 32-bit and 64-bit versions). This means that each package needs to be installed for a specific architecture.
The fix is to remove your existing packages (back them up first, natch), then reinstall them.

Resources