cannot install plyr package in R [duplicate] - r

This question already has answers here:
How should I deal with "package 'xxx' is not available (for R version x.y.z)" warning?
(18 answers)
Closed 8 years ago.
I tried installing the plyr package and I got the warning message saying it isn't available for R version 3.0.2. Is this true or is no? If not, why would I be getting this message? I tried using two different CRAN mirrors and both gave the same message.

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.

Related

Unable to install Peaks package: package ‘Peaks’ is not available for this version of R [duplicate]

This question already has answers here:
How should I deal with "package 'xxx' is not available (for R version x.y.z)" warning?
(18 answers)
Closed 12 months ago.
I am working with series data and want to count the number of local 'maxima' and 'minima' (i.e. peaks and troughs/oscillations) along each series. I want to use the 'Peaks' package for this but only get the following error:
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
Warning in install.packages :
package ‘Peaks’ is not available for this version of R
A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
As suggested I installed rtools without any problems but it still returned the same error when I tried installing 'Peaks'. I have not found any information at the cran.r-project link and have also tried to install findpeaks but got the same error. I am not actually sure what version I am running on my desktop (how do you check?); but I have tried it also on Rstudiocloud, which I think is the latest version (4.1.2).I have also tried:
findPeaks(MaxMn, thresh=0)
findValleys(MaxMn, thresh=0)
but R couldn't find the function. I'm a little confused about whether it is a package or function and what I need to do to make it happen. Any suggestions would be greatly appreciated.
Peaks vignette: https://www.rdocumentation.org/packages/splus2R/versions/1.3-3/topics/peaks
After installing Rtools, you need to put it on the system PATH so that R can find it while trying to build a package from its source code. It's highly likely that in your case Rtools is installed but not on the system path.
You can find the latest details on the process of installing rtools, adding to path and verifying installation is correct from Rtools page (https://cran.r-project.org/bin/windows/Rtools/rtools40.html).
The package is no longer available on CRAN: "Archived on 2019-04-18 as check problems were not corrected despite reminders."
From googling "R detect peaks", it looks like there are a number of current packages you might be able to use, including pracma and peakPick. In addition to CRAN, this also feels like something the Bioconductor repository may have packages for.

Running an old version of R in Rstudio

I'm using a package (ggmap) that doesn't work on R 3.6.1 (Windows), so I would like to install a previous version of R. Once the version is installed, I found how to force Rstudio to use it (through the options panel).
The issue is I am not able to install a previous version. I've downloaded the directory (didn't do anything with it besides drag-and-drop into my R directory), but when I try to force Rstudio to use it, I get the following message:
"This directory does not seem to contain a valid R installation".
The parent directoy is the same that has the R 3.6.1, which works fine.
Thanks for any help!
I am using R version 3.6.0 (2019-04-26) and I was able to install the mentioned package:
install.packages('ggmap')
In my experience, sometimes I also think it's due to a version incompatibility when it isn't. For example, I might get a message similar to this:
Warning in install.packages :
package 'biomaRt' is not available (for R version 3.6.0)
To which most of the time the solution includes using setRepositories():
setRepositories()
Enter one or more numbers separated by spaces, or an empty line to cancel
1: 1 2 3 4 5 6 7 8
In this case, I added all of them just in case, which reassures that if the package exists and is available for my version, it will be installed (You may want to reset it again to a single repository, as it may slow the installation of other packages).
Edit: If you actually get the Error message I mentioned, you might be interested in looking at this answer if setRepositories() does not fix your issue.

Warning in install.packages : cannot remove prior installation of package ‘data.table’ [duplicate]

This question already has answers here:
R package updates
(4 answers)
Closed 4 years ago.
I tried to install package data.table in R. This error showed up. Could anyone resolve this?
I assume you're on Windows. You may have data.table loaded into your session already; on Windows, dlls that are part of a package can't be unloaded until R shuts down. So restart R and then try running install.packages again.
Try running R with admin access (sudo in Linux, or for Windows, right click and choose "Run as Administrator"). I had the same problem when running R from PowerShell in Windows, and this fixed it.

Where are the installed R packages? [duplicate]

This question already has answers here:
Where does R store packages?
(4 answers)
Closed 8 years ago.
Where are the installed R packages?
For example, after installing packages with 'install.packages("mlbench")' and so on, only "The downloaded binary packages are in C:\Users\ABC\AppData\Local\Temp\Rtmp2XB0sh\downloaded_packages" is a piece of related info from the console messages.
However, I fail to find them at all after scouring my computer according to package names (not just listing them with 'installed.packages()'). This question seems very difficult for me, but strangely I found almost no answer online. Where are the installed packages on the local computer?
You can view the location by running the following:
.libPaths()
#[1] "C:/Users/ujjwal/Documents/R/win-library/3.1" "C:/Program Files/R/R-3.1.1/library"
R packages are installed into libraries, which are directories in the file system containing a subdirectory for each package installed there.
R comes with a single library, R_HOME/library which is the value of the R object .Library containing the standard and recommended packages. At the lowest level .libPaths() can be used to add paths to the collection of libraries or to report the current collection.
R will automatically make use of a site-specific library R_HOME/site-library if this exists. This location can be overridden by setting .Library.site in R_HOME/etc/Rprofile.site. For more details see here.

binary packages not available after update R to 3.1.2 [duplicate]

This question already has answers here:
How should I deal with "package 'xxx' is not available (for R version x.y.z)" warning?
(18 answers)
Closed 8 years ago.
I have just updated R to version 3.1.2, and many packages seem not yet available, such as RmySQL.
What can I do? Uninstall the latest version of R and go back to version 3.0? Or are there other ways?
The problem is especially related to Apple, although for some packages (eg RMySQL) this problem can occur in Windows as well.
On Apple, you can try to install from source:
install.packages('plotGoogleMaps', type='source')
Note that with RMySQL you also have to make sure your environment variables are set correctly. You find more info on the installation procedure on their CRAN page.
On Windows, you need to install Rtools before you can install from source:
http://cran.r-project.org/bin/windows/Rtools/
After you've done that, you can use the same option as above.
Be warned though that building from source might require a manual configuration of your system. This is the case for both rgeos and RMySQL. Information on these procedures can be found on the CRAN page of either package:
eg for rgeos you need to preinstall GEOS as specified in the system requirements:
http://cran.r-project.org/web/packages/rgeos/index.html
For RMySQL you need to set up yor environment variables, as specified here:
http://cran.r-project.org/web/packages/RMySQL/INSTALL
EDIT: Building on MAC
If you want to build binary packages on Mac machines, you need to take into account that you might need extra tools, especially when these packages contain compiled code. This is explained in more detail in the R FAQ for Mac and the Administration and Installation manual:
http://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html#Installation-of-source-packages
http://cran.r-project.org/doc/manuals/r-release/R-admin.html#OS-X
Alternatively, you might want to check the R for MAC's Developer page at http://r.research.att.com/ This one contains more information on the toolchain you need.

Resources