get functions from old package [duplicate] - r

This question already has answers here:
extracting source code from r package
(2 answers)
Closed 8 years ago.
There are a number of packages that have functions I would like to use, however these packages are no longer maintained and were built for older R versions.
Using R 3.0.02 I get the following
install.packages("steepness")
Warning message:
package ‘steepness’ is not available (for R version 3.0.2)
Similarly using
packageurl <- "http://cran.r-project.org/src/contrib/Archive/steepness/steepness_0.2.tar.gz"
install.packages(packageurl, contriburl=NULL, type="source")
Warning message:
package ‘http://cran.r-project.org/src/contrib/Archive/steepness/steepness_0.2.tar.gz’ is not available (for R version 3.0.2)
and when i manually place the steepness folder in the win-library:
library(steepness)
Error: package ‘steepness’ was built before R 3.0.0: please re-install it
I only want a couple functions to save myself time rewriting everything from scratch. What is the best way round this? Can I just copy the source code for the two functions myself for example and define them myself? I have looked at the folder for the package but there is no obvious .r file to steal code from ONLY .rdb AND .rdx which are file formats I am not familiar with.

If you have some experience with defining functions in R you can just download the bundled *.tar.gz package from CRAN, look in the R folder of the unpacked package and extract the code you need.

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.

Griliches( dataset) from Ecdat not compatiable with current version of R

I have been using the dataset Griliches for a project. Tried going back to project and this error appears
Warning in install.packages :
package ‘Griliches’ is not available (for R version 3.6.1)
A couple of weeks ago I updated all my packages, maybe this was the problem? I've tried deleting and downloading R again, also tried installing Griliches again.
I am new to R and finding this very confusing, also apologies if I didn't present my question properly.
I assume you mean the data set 'Griliches'? This can be found from library Ecdat. Maybe you are confusing data and library with each other?
install.packages('Ecdat')
library(Ecdat)
data('Griliches')
An alternative source for the same data is in Github. The Github version can be installed by:
install.packages('devtools')
devtools::install_github('lachlandeer/hayashir')
library(hayashir)
data(griliches)

Where can I find function source codes in a .zip R package?

I'd like to use package CentiServer in R. However, I'm getting the same error with different R versions (3.3.3 and 3.1.1):
Warning: unable to access index for repository
https://cloud.r-project.org/bin/windows/contrib/3.1 Warning message:
package ‘CentiServer’ is not available (for R version 3.1.1)
This post is a great source, still, these steps couldn't help me to find a solution: How should I deal with "package 'xxx' is not available (for R version x.y.z)" warning?
Since I cannot install the package, I started to think about that it could be easier to just find the source codes of some useful functions in the .zip file. Where can I find those in the .zip file?
Thank you in advance.

How do I install an older R package? [duplicate]

This question already has answers here:
Installing older version of R package
(8 answers)
Closed 7 years ago.
I am trying to install the R package bigrf using the following command:
install.packages('bigrf')
However, I receive this error:
Warning in install.packages: package 'bigrf' is not available (for R version 3.0.2).
I understand that the package was not built for R version 3.0.2, but is it not possible for me to install it regardless with the understanding that it might not have complete forward compatibility?
The safest thing to do would be to download the last version that the package was built for (link) and run the code on that version.
The easiest way to rebuild a package from source is using R-Studio.
They have a good walkthrough. You will need to use the devtools package as well.

Error while loading bquant package in r

I installed BQuant package in my windows system.When I loaded the package it showed the following error Error: package ‘BQuant’ is not installed for 'arch=i386' . Can anyone please sort it out.If not is there any other packages for NMR analysis in R.
Since according to your recent other question you are only interested in a good peak detection algorithm, you could get the code of the relevant functions directly from the package source (look in folder R inside the zip).

Resources