Dependencies 'dplyr','XML'not available for package <pkg> - r

I am creating an R package I have completed the R CMD Build and R CMD Check and removed all warnings. I am trying to install the <package>.tar.gz on another machine to see whether it goes through fine. But I get this error
> install.packages("cricketr_0.0.9.tar.gz",repos=NULL,type="SOURCE",dependency=TRUE)
ERROR: dependencies 'dplyr', 'plotrix', 'ggplot2', 'scatterplot3d', 'forecast', 'lubridate', 'XML' are not available for package 'cricketr'
Depends:
R (>= 2.15.0)
Imports:
dplyr,
plotrix,
ggplot2,
scatterplot3d,
forecast,
lubridate,
XML
URL: https://github.com/tvganesh/cricketr
While installing on a new system from the tarball should I manually install dependent packages since it will be available once the package is in CRAN?
Any help will be appreciated

In my experience, dependencies are met once you install from a distribution platform like CRAN or GitHub. Note also that in ?install.packages it says:
Not used if repos = NULL.

Related

How to install specific version of an R package while also installing dependencies, without install_version()?

I am trying to install an older version (1.6.3) of the 'usethis' package, because the package 'gert' can't be correctly configured with latest version (2.0.0) in my environment (AWS EMR 5.15.0): it shows 'configuration failed for package gert' when installing usethis.
In this case, I can't use install_version() because install_version() is part of the 'devtools' package, which depends on usethis.
I tried to use install.package() as follows:
packageurl <- "https://cran.r-project.org/src/contrib/Archive/usethis/usethis_1.6.3.tar.gz"
install.packages(packageurl, repos=NULL, type="source")
However, in this way, the dependent packages are not installed and the installation can't be done. While I try this:
packageurl <- "https://cran.r-project.org/src/contrib/Archive/usethis/usethis_1.6.3.tar.gz"
install.packages(packageurl, repos="http://cran.rstudio.com", type="source")
It shows error of package "https://cran.r-project.org/src/contrib/Archive/usethis/usethis_1.6.3.tar.gz" not available for R(3.6.3), I believe it is because R interpret the URL to be a package name rather than URL when repos is not NULL.
How should I install a specific version while asking R to install dependencies? Thanks in advance.

install quantstrat for R latest R version ()

I would like to install a package when using the latest R version in RStudio.
In particular the quantstrat package
Is that possible?
This is the R latest version I have 3.4.1
my error message:
Warning in install.packages :
package ‘quantstrat’ is not available (for R version 3.4.1)
Because quantstrat build-fail at R-Forge, you can't get the pre-build file(.tar.gz). You can get the code from github and build by yourself.
install.packages("devtools")
require(devtools)
install_github("braverock/blotter") # dependency
install_github("braverock/quantstrat")
Can you provide the installation code that produced that error message? Are you trying to install it from CRAN?
That doesn't appear possible.
A post from 2014 states it's not on CRAN
quantstrat is a R package ... still under heavy development and can’t be installed from CRAN yet. You can install it from source and the process is straightforward.
It's not on the current list of available CRAN packages
It's R-Forge page states the current version 'Failed to build'.
You could download the previous version (and its dependency) from R-Forge at
http://download.r-forge.r-project.org/bin/windows/contrib/3.2/quantstrat_0.9.1739.zip and
http://download.r-forge.r-project.org/bin/windows/contrib/3.2/blotter_0.9.1741.zip
(or get the Linux tar.gz files). Assuming they're saved in your personal Downloads folder, install it in R with
install.packages("~/Downloads/blotter_0.9.1741.zip", repos = NULL)
install.packages("~/Downloads/quantstrat_0.9.1739.zip", repos = NULL)
According to that first link, you'll need to install these prereqs first, if they're not already:
install.packages("FinancialInstrument")
install.packages("PerformanceAnalytics")
install.packages("foreach")
Edit: see the comment below from #brian-g-peterson for how the current deployment avenue uses GitHub. https://github.com/braverock/quantstrat

R package dependencies not installed from Additional_repositories (revisited)

I am attempting to prepare a package for submission to the CRAN. In my DESCRIPTION file I include non-CRAN packages in the Depends and Suggests arguments. To tell R where to find the non-CRAN packages, I include the Additional_repositories argument; and I include an .onLoad function at the top of my program (i.e., in 'zzz.R'). I am able to build and check (--as-cran) in RStudio with zero warnings, notes or errors so long as all the Depends and Suggests packages are present. I then use devtools::build() to create a .tar.gz file locally.
To test for a successful local install, I remove the non-CRAN packages from my computer and attempt to install the .tar.gz file that I created. I then get the message:
ERROR: dependency 'smwrQW' is not available for package 'baytrends'
I've read through the
R package dependencies not installed from Additional_repositories
Include non-CRAN package in CRAN package
http://thecoatlessprofessor.com/programming/r-data-packages-in-external-data-repositories-using-the-additional_repositories-field/
How should I deal with "package 'xxx' is not available (for R version x.y.z)" warning?
Unfortunately, the above error continues. I'm confident of the url I'm using since the below install.package line works when run independently
install.packages('smwrQW',repos=c("http://owi.usgs.gov/R"),dependencies = TRUE)
The applicable bits of the DESCRIPTION and zzz.R file are below:
DESCRIPTION:
Date: 2017-03-15
Depends:
R (>= 3.2.0),
lubridate,
mgcv,
smwrQW
License: GPL-3
LazyData: TRUE
RoxygenNote: 6.0.1
Suggests:
dataRetrieval,
devtools,
fitdistrplus,
knitr,
nlme,
pander,
plyr,
rmarkdown,
smwrBase,
smwrGraphs,
smwrStats,
testthat
Additional_repositories: http://owi.usgs.gov/R
VignetteBuilder: knitr
zzz.R:
.onLoad <- function(libname = find.package("baytrends"), pkgname = "baytrends"){
repos = getOption("repos")
repos["USGS"] = "http://owi.usgs.gov/R"
options(repos = repos)
invisible(repos)
# declaration of global variables (https://stackoverflow.com/questions/9439256)
if(getRversion() >= "2.15.1")
utils::globalVariables(c("begin", "methodsList"))
invisible()
}
.onAttach <- function(libname = find.package("baytrends"), pkgname = "baytrends"){
packageStartupMessage("This software program is preliminary or provisional and is subject to revision. ")
}
You cannot have packages from non-standard repos in Depends: or Imports:.
You can have them in Suggests:
Several packages do this; one you could look at is hurricaneexposure which uses this to make a 'too-large-for-CRAN' data package hurricanexposuredata available from a repository created via drat.
So you must move the smwrQR package to Suggests: and then test for it.
Brooke and I have a draft paper (under review) on this which we could send you if you drop us line -- it details all this more than the short answer could.

How to install GGRAPH package to the latest R (v.3.3.2)

I am very new to R and I need ggraph library and it can't be installed from rstudio console. Here is a message:
Warning in install.packages : package ‘ggraph’ is not available (for
R version 3.3.2)
Are there other ways of installation? Looks like this library lives and flourishes:
https://www.r-bloggers.com/introduction-to-ggraph-layouts/
This requiresudunits2 library.
I use conda R, so I installed it using conda install -c ioos udunits2=2.2.20. You need to use a package manager to get it installed.
Then install the udunits2 R package
install.packages('udunits2', type = "source",
configure.args=c('--with-udunits2-lib=/Users/Karthik/anaconda/lib'))
Replace /Users/Karthik/anaconda/lib with the path to your R libraries. You can find it using .libPaths()
Finally install the development version of R packages
devtools::install_github("thomasp85/ggraph", dependencies=TRUE)

install R packages automatically [duplicate]

This question already has answers here:
How to install dependencies when using "R CMD INSTALL" to install R packages?
(7 answers)
Closed 9 years ago.
I created a R package. The DESCRIPTION file of this package is as follows:
Package: Ralgotree
Type: Package
Title: package about securiy information
Version: 1.0
Date: 2013-02-15
Author: algotree
Maintainer: algotree<dinoop#algotree.com>
Description: package about securiy information
License: GPL(>=2)
Suggests: RJSONIO,stringr,RSQLite,bigmemory,Rook,compare,plyr,lubridate,xts
Depends: RJSONIO,stringr,RSQLite,bigmemory,Rook,compare,plyr,lubridate,xts
It depends on other packages like RJSONIO,stringr etc.
So whenever i try to install my package in other machine using the following commands
R CMD build Ralgotree
R CMD INSTALL Ralgotree
it showing the following error messages:
* installing to library ‘/usr/local/lib/R/site-library’
ERROR: dependencies ‘RJSONIO’, ‘stringr’, ‘RSQLite’, ‘bigmemory’, ‘Rook’, ‘compare’, ‘plyr’, ‘lubridate’, ‘xts’ are not available for package ‘Ralgotree’
So i need to do install all packages like this install.packages("RJSONIO").
Is it possible to install all uninstalled packages when we run R CMD INSTALL Ralgotree command?
Thanks
Try,
install.packages("mypkg", dependencies = TRUE)
I do not see that as an option in the arguments listed when I run:
R CMD INSTALL --help
The install.packages R function does have a "dependecies" argument which when TRUE (or the proper character vector) will gather a list of packages from the Description file and install them as well.
?install.packages

Resources