How to install microbiomeSeq package? - r

I've been having a lot of trouble installing the package "microbiomeSeq" in Rstudio.
I keep getting errors like:
ERROR: dependency 'KMDA' is not available for package 'microbiomeSeq'
removing 'C:/Users/14142/AppData/Local/R/win-library/4.2/microbiomeSeq'
Warning message:
In i.p(...) :
installation of package ‘C:/Users/Public/Documents/Wondershare/CreatorTemp/Rtmpc7iXOi/file7643cdd730b/microbiomeSeq_0.1.tar.gz’ had non-zero exit status
library(microbiomeSeq)
Error in library(microbiomeSeq) :
there is no package called ‘microbiomeSeq’

The KMDA package has been archived from CRAN:
Archived on 2022-06-14 as check problems were not corrected despite reminders.
Perhaps the maintainers will resolve this and republish (perhaps unlikely since the package has not been updated since 2015), but until then you can install it from github. Note: all (I think) CRAN packages are mirrored in their basic form under https://github.com/cran. I say "basic" because it is not a clone of the original github repo (if it is even on github), it is just a repo that is generated from the source tarball of packages released on CRAN.
if (!"remotes" %in% installed.packages()[,1]) install.packages("remotes")
remotes::install_github("cran/KMDA")

Related

Can't install package 'nutshell' from O'Reilly book 'R in a Nutshell' onto Mac

My first post in an early programming career - any help very welcome.
I am studying R, and using a book called R in Nutshell (O'Reilly). The book is supported by a package that was previously available on CRAN. The package on CRAN has been archived - it is still there though as nutshell_2.0.tar.gz.
I am running MacOS Catalina, R version 3.2.1.(after downgrading from 4.02 to try and solve this issue , without success), and RStudio version 1.3.1093.
When I try to install the package into R via RStudio I have this experience:
packageurl <- "https://cran.r-project.org/src/contrib/Archive/nutshell/nutshell_2.0.tar.gz
install.packages(packageurl,contriburl=NULL,type="source")
Warning in install.packages :
package ‘https://cran.r-project.org/src/contrib/Archive/nutshell/nutshell_2.0.tar.gz’ is not available (for R version 3.2.1)
I have a similar experience if I download the tar.gz file and try to import it directly under Tools/Install Packages.
I am able to install other packages on CRAN successfully.
Many thanks
Up front, I'm doing this on windows and not on macos, but the packages here have no compiled code so there should be few if any differences. Also, I tested on R-4.0.2; I don't think this will be a problem, because these packages appear to have been last-updated in 2012, so if they install on my 4.0.2, then they are likely to work on every version of R since then (including your 4+ year-old R-3.2).
download.file("https://cran.r-project.org/src/contrib/Archive/nutshell.audioscrobbler/nutshell.audioscrobbler_1.0.tar.gz", "nutshell.audioscrobbler_1.0.tar.gz")
download.file("https://cran.r-project.org/src/contrib/Archive/nutshell.bbdb/nutshell.bbdb_1.0.tar.gz", "nutshell.bbdb_1.0.tar.gz")
download.file("https://cran.r-project.org/src/contrib/Archive/nutshell/nutshell_2.0.tar.gz", "nutshell_2.0.tar.gz")
install.packages("nutshell.audioscrobbler_1.0.tar.gz", repos = NULL)
install.packages("nutshell.bbdb_1.0.tar.gz", repos = NULL)
install.packages("nutshell_2.0.tar.gz", repos = NULL)
I tried reproducing installation from archive. I got error that dependencies of this package are not available.
ERROR: dependencies 'nutshell.bbdb', 'nutshell.audioscrobbler' are not available for package 'nutshell'
* removing 'C:/Program Files/R/R-3.6.2/library/nutshell'
Warning in install.packages :
installation of package ‘D:/Profile/maszpa1/Desktop/nutshell_2.0.tar.gz’ had non-zero exit status
Did you get the same error? If yes, then did you try to install them and try again?
As per the accepted answer, the solution was to install the missing dependent packages first, then the Nutshell package.
I was then able to update to R4.02
audioscrobbler_1.0.tar.gz
nutshell.bbdb_1.0.tar.gz
nutshell_2.0.tar.gz

Error while installing package in RStudio

I'm not able to install the IntroCompFinR package in RStudio due to this error:
> install.packages("IntroCompFinR")
Installing package into ‘C:/Users/HP/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
Warning in install.packages :
package ‘IntroCompFinR’ is not available (for R version 3.6.1)
Try the R-Forge repo?
install.packages("IntroCompFinR", repos="http://R-Forge.R-project.org")
You may also have to install quadprog from another repo first.
install.packages("quadprog", repos="http://cran.rstudio.com")
install.packages("IntroCompFinR", repos="http://R-Forge.R-project.org")
install.packages("package_name") from devtools library works only when the package is enlisted in CRAN, and complies with your R version.
Three alternatives if it is available, but either not in CRAN or not compatible with your R version:
Install via Github: If your package is incorporated in a Github repository (most packages are), then you can use
install_github("github_UsernameOfAuthor/repository_name")
Other prominent repository holders include bitbucket and gitorious, for which
install_bitbucket("package_Author/repository_name")
and
install_gitorious("package_Author/repository_name")
apply respectively.
Install via R-Forge: If your repository is uploaded to R-Forge, you can use
install.packages("package_name", repos="http://R-Forge.R-project.org")
This is applicable in your case since there is an R-Forge repository for the IntroCompFinR library, with the install command being mentioned here as well.
Install via some other source URL/website: If your package has a repository somewhere on the internet, you can use the source-link to install the package via
install.packages("package_name", repos="URL")`.
Note: All of these commands are provided by devtools, which you seem to have, but just in case you don't, you can use these commands to install both devtools and your required package:
# Install directly from CRAN:
if(!require(devtools))install.packages("devtools")
devtools::install.packages("package_name")
# Install via Github:
if(!require(devtools))install.packages("devtools")
devtools::install_github("githubAuthor_username/package_name")
# Install via R-Forge or any other repository holding website:
if(!require(devtools))install.packages("devtools")
devtools::install.packages("package_name",repos="website-link")
Most package authors give installation commands in their package vignette or via their Github repository for the same, but you can acquire the package directly provided you know its name and link to the source repository.
You can use this post as a reference when installing R packages in the future.

Trying to install tm package in R but it fails

Trying to install tm package in R but I get the following error.
Installing package into ‘C:/Users/resmim/Documents/R/win-library/3.2’ (as ‘lib’ is unspecified) also installing the dependency ‘slam’
Packages which are only available in source form, and may need compilation of C/C++/Fortran: ‘slam’ ‘tm’ These will not be installed
Type this in your console:
chooseCRANmirror()
And choose your CRAN Mirror. I like Spain :). Then try re-installing your package.
In addition to trying your luck with a few different mirrors, be sure to answer 'N' when asked 'Do you want to install from sources the package which needs compilation?' This solved the problem for me.
update r version to latest, it just worked for me.
to do this, download latest version of R from cran and install it. no uninstall required for previous versions.

Cant install blotter package used for quantstrat

I'm trying to use the quantstrat package in R. I have uploaded/installed the package using
install.packages("quantstrat", repos="http://R-Forge.R-project.org")
However the once I use
require(quanstrat)
I get the message :
Loading required package: quantstrat
Failed with error: ‘package ‘blotter’ required by ‘quantstrat’ could not be found’
I then use
install.packages("blotter", repos="http://R-Forge.R-project.org")
but get the following message:
Package which is only available in source form, and may need compilation of C/C++/Fortran:
‘blotter’
These will not be installed
Can anyone offer some suggestion?
I am very late here, but perhaps relevant to note that "blotter" and "quantstrat" are not on CRAN, and several years ago moved to GitHub. The README on the repo (https://github.com/braverock/quantstrat) has more information for installing blotter and more importantly quantstrat.
install.packages("devtools") # if not installed
install.packages("FinancialInstrument") #if not installed
install.packages("PerformanceAnalytics") #if not installed
# next install blotter from GitHub
devtools::install_github("braverock/blotter")
# next install quantstrat from GitHub
devtools::install_github("braverock/quantstrat")

install a R package needed for your package upon installation

I'm developing a R package that depends on another R package being installed on the users system.
I've added a Depends:pkgname in the DESCRIPTION file and import(pkgname) in the NAMESPACE. What I was hoping this would do is check if pkgname is already installed and if not install.packages(pkgname,repos="CRAN or Rforge or wherever the package is") if not.
However upon attempted installation of my package i get the error:
ERROR: dependency 'pkgname' is not available for package 'mypkg'
Does anyone know how to implement an installation of pkgname, should pkgname not already be on the system?
Many thanks
In the help file of R CMD INSTALL there is no mention of a flag to install additional packages if needed for dependencies. If you submit your package to CRAN, your problems are solved because install.packages then solves any dependencies. install.packages does not support solving dependencies when installing from a local file.
Until you submit to either R-forge or CRAN, I think it will suffice to add a remark to the README file that a few additional packages need to be present. You could even post a snippet of R code containing the needed install.packages command.

Resources