Is the Plyr Package for R Not Available for R Version 3.0.2

Is the plyr package for R not available for R version 3.0.2?

The answer is that the package is available in R (just checked this on my machine).

The particular error message that you are getting is very misleading. It is R's `catch-all' condition for anything that it doesn't understand going wrong during installation. You will get this error if you mis-spelled anything (Plyr instead of plyr) or your network connection is not working, or you are behind a proxy or whatever.

I typically get this problem when I am behind a proxy or I have mis-spelled something. But it can be because of any other number of reasons. I will suggest you make sure you can access the internet from inside R first.

If nothing works, you can always download the package from CRAN using a browser. If you are on Windows, you want the .zip version and if you are on *nix you want the .tar.gz version. (.tgz for Macs?). Then you can install it like so:

setwd("/path/where/I/downloaded/the/compressed/file")
install.packages("plyr", repos=NULL)

See if that works.

How should I deal with package 'xxx' is not available (for R version x.y.z) warning?

1. You can't spell

The first thing to test is have you spelled the name of the package correctly? Package names are case sensitive in R.


2. You didn't look in the right repository

Next, you should check to see if the package is available. Type

setRepositories()

See also ?setRepositories.

To see which repositories R will look in for your package, and optionally select some additional ones. At the very least, you will usually want CRAN to be selected, and CRAN (extras) if you use Windows, and the Bioc* repositories if you do any biological analyses.

To permanently change this, add a line like setRepositories(ind = c(1:6, 8)) to your Rprofile.site file.


3. The package is not in the repositories you selected

Return all the available packages using

ap <- available.packages()

See also Names of R's available packages, ?available.packages.

Since this is a large matrix, you may wish to use the data viewer to examine it. Alternatively, you can quickly check to see if the package is available by testing against the row names.

View(ap)
"foobarbaz" %in% rownames(ap)

Alternatively, the list of available packages can be seen in a browser for CRAN, CRAN (extras), Bioconductor, R-forge, RForge, and GitHub.

Another possible warnings message you may get when interacting with CRAN mirrors is:

Warning: unable to access index for repository

Which may indicate the selected CRAN repository is currently be unavailable. You can select a different mirror with chooseCRANmirror() and try the installation again.


There are several reasons why a package may not be available.


4. You don't want a package

Perhaps you don't really want a package. It is common to be confused about the difference between a package and a library, or a package and a dataset.

A package is a standardized collection of material extending R, e.g. providing code, data, or documentation. A library is a place (directory) where R knows to find packages it can use

To see available datasets, type

data()

5. R or Bioconductor is out of date

It may have a dependency on a more recent version of R (or one of the packages that it imports/depends upon does). Look at

ap["foobarbaz", "Depends"]

and consider updating your R installation to the current version. On Windows, this is most easily done via the installr package.

library(installr)
updateR()

(Of course, you may need to install.packages("installr") first.)

Equivalently for Bioconductor packages, you may need to update your Bioconductor installation.

source("http://bioconductor.org/biocLite.R")
biocLite("BiocUpgrade")

6. The package is out of date

It may have been archived (if it is no longer maintained and no longer passes R CMD check tests).

In this case, you can load an old version of the package using install_version()

library(remotes)
install_version("foobarbaz", "0.1.2")

An alternative is to install from the GitHub CRAN mirror.

library(remotes)
install_github("cran/foobarbaz")

7. There is no Windows/OS X/Linux binary

It may not have a Windows binary due to requiring additional software that CRAN does not have. Additionally, some packages are available only via the sources for some or all platforms. In this case, there may be a version in the CRAN (extras) repository (see setRepositories above).

If the package requires compiling code (e.g. C, C++, FORTRAN) then on Windows install Rtools or on OS X install the developer tools accompanying XCode, and install the source version of the package via:

install.packages("foobarbaz", type = "source")

# Or equivalently, for Bioconductor packages:
source("http://bioconductor.org/biocLite.R")
biocLite("foobarbaz", type = "source")

On CRAN, you can tell if you'll need special tools to build the package from source by looking at the NeedsCompilation flag in the description.


8. The package is on GitHub/Bitbucket/Gitorious

It may have a repository on GitHub/Bitbucket/Gitorious. These packages require the remotes package to install.

library(remotes)
install_github("packageauthor/foobarbaz")
install_bitbucket("packageauthor/foobarbaz")
install_gitorious("packageauthor/foobarbaz")

(As with installr, you may need to install.packages("remotes") first.)


9. There is no source version of the package

Although the binary version of your package is available, the source version is not. You can turn off this check by setting

options(install.packages.check.source = "no")

as described in this SO answer by imanuelc and the Details section of ?install.packages.


10. The package is in a non-standard repository

Your package is in a non-standard repository (e.g. Rbbg). Assuming that it is reasonably compliant with CRAN standards, you can still download it using install.packages; you just have to specify the repository URL.

install.packages("Rbbg", repos = "http://r.findata.org")

RHIPE on the other hand isn't in a CRAN-like repository and has its own installation instructions.

How to install packages in R or Rstudio

You have an outdated version of R. Normally dplyr and your other dependencies would be automatically installed, but in this case they are labelled as not working with older versions of R, so throw an error.

You have version 3.0.2, which is out of date. As of now the current version is 3.2.1. You should upgrade (you don't have the most up to date version of r-base, repos are often behind - try getting the binary from here).

If you don't want to update you can use the methods described in answers to this question to install older versions of the packages which may be compatible with your version - install older version of R package.

Install package from source throws package not available in R

Your package does not pass R CMD check:

> R CMD check sjPlot_0.1.tar.gz

* using log directory ‘/home/edisz/Downloads/sj_tmp/sjPlot.Rcheck’
* using R version 3.0.2 (2013-09-25)
* using platform: x86_64-pc-linux-gnu (64-bit)
* using session charset: UTF-8
* checking for file ‘sjPlot/DESCRIPTION’ ... OK
* checking extension type ... Package
* this is package ‘sjPlot’ version ‘0.1’
* checking package namespace information ... OK
* checking package dependencies ... ERROR
Namespace dependencies not required:
‘HH’ ‘MASS’ ‘car’ ‘faraway’ ‘foreign’ ‘ggplot2’ ‘lmtest’ ‘plyr’
‘reshape2’ ‘scales’ ‘vcd’

See the information on DESCRIPTION files in the chapter ‘Creating R
packages’ of the ‘Writing R Extensions’ manual.

Exited with status 1.

Looking at your DESCRIPTION file, you'll see that the Collate and Import fields are missing.
Roxygen take care of the Collate fields (If you're using RStudio Configure roxygen to do so), however you have to write the Import field manually to the DESCRIPTION.

Looking at one of your functions:

#' @title Import SPSS dataset as data frame into R
[snip]
#'
#' @param path the file path to the SPSS dataset
#' @param enc the file encoding of the SPSS dataset
#' @return a data frame containing the SPSS data. retrieve value labels with \code{\link{sji.getValueLabels}}
#' and variable labels with \code{\link{sji.getVariableLabels}}

[snip]
#' @export
sji.SPSS <- function(path, enc=NA) {
# init foreign package
require("foreign")
# import data as data frame
data.spss <- read.spss(path, to.data.frame=TRUE, use.value.labels=FALSE, reencode=enc)
# return data frame
return(data.spss)
}

You see that there is a require('foreign') call, but no @import foreign tag.
I would suggest to remove the line require('foreign') (it's not needed, if you import the package) and add a @import foreign tag.

Than add to your Description file

Imports:
foreign

Do this with all other functions and packages.

Hope this helps (and is correct),



Related Topics



Leave a reply



Submit