What are "reverse dependencies" in R? - r

I have to install the rjson package in R and looking at the CRAN page that deals with the package I saw that rjson has different dependencies:
Reverse depends: couchDB, df2json, edeR, gooJSON, indicoio, kintone, notifyR, RDSTK, Rfacebook, rJython, Rlabkey, rPlant, RYoudaoTranslate, SmarterPoland, sotkanet, source.gist, Storm, streamR, tibbrConnector, zendeskR;
Reverse imports: AntWeb, argparse, BerlinData, blsAPI, Causata, d3Network, db.r, geonames, GetoptLong, ggmap, h2o, helsinki, james.analysis, meteoForecast, mpoly, networkD3, ngramr, nhlscrapr, OpasnetUtils, OutbreakTools, paleobioDB, RAdwords, rbefdata, rClinicalCodes, rfisheries, rglobi, RIGHT, rnrfa, solr, StereoMorph, structSSI, twitteR, vdmR, yhatr;
Reverse suggests: fuzzyMM, GSIF, installr, mlr, plotKML, rsnps, sorvi, trajectories;
What is the difference among them and do I have to install all of them to use the rjson package?

These are reverse dependencies, that is these packages depend on rjson.
You do not have to install these in order to use rjson.
Looking at the DESCRIPTION file (this is where the dependencies are stated) you see only:
Depends: R (>= 3.1.0)
So rjson package needs only R newer or equal than 3.1.0 to run.

Just as EDi has stated, the list states packages that depend on rjson.
I think kintone has been knocked off the list, since the cloud service itself is not dependent on rjson. The R SDK for kintone though, is dependent on rjson, as shown in the README of the GitHub page.
So in this case, if I wanted to run kintone's APIs using this R SDK, I would also need the rjson package for it to work properly.

Related

Import R package from Github when developing R package

I am trying to develop my own R package, which relies on the R package enrichR (from wjawaid/enrichR). This package is available on both CRAN and Github, but due to a bug in their CRAN version, I want to exclusively use their Github package (v2.1). I've followed
Create an R package that depends on another R package located on GitHub to try and adjust my DESCRIPTION so that I don't get that bug, but it hasn't been working so far. This is what I've tried:
Imports: enrichR (>= 2.1)
Remotes: wjawaid/enrichR
How would I be able to import the Github version of enrichR specifically into my package? I'm not having issues when I use enrichR outside of this package.
I believe what you have is sufficient as long as you use remotes::install_local or remotes::install_github or similar to install your package. If you are using the basic install.packages or R CMD INSTALL to install it, you need to put a copy of enrichR 2.1 in a CRAN-style repository, and refer to that repository in an Additional_repositories field in your DESCRIPTION file. This is easier than it sounds, using drat: see https://github.com/drat-base/drat .

Use GitHub Package R Actions

I was trying to use actions in a package I wrote. The issue is that the package actions uses remotes in its setup to install CRAN only packages.
Since the package I am working on depends on a non CRAN package that is present on GitHub, both coverage and R CMD checks fail. I tried to avoid this by naively downgrading to an earlier version of the package in depends but some functions are not exported. I am wondering if someone knows a workaround that might help(I cannot open an issue at actions since their support.md file discourages this).
If your package depends on a non-CRAN package, you must include under Remotes: rather than just Imports: in your DESCRIPTION file. Here you would have:
Imports:
actions
Remotes:
r-lib/actions
This will pass checks, but there is no work around for publishing to CRAN if any of your dependencies are not on CRAN, thus you'll get a warning if any packages are present in the Remotes field.
The alternative using Travis is adding r_github_packages: r-lib/actions to your .travis.yml.
After some time, I have found a workaround that for now is good enough if you want to test for the development version(like I wanted). You should include an install_github command in the check.yaml file. Here's an example:
- name: Install dependencies
run: |
install.packages(c("remotes","testthat"),dependencies=TRUE)
remotes::install_github("tidyverse/dplyr")
remotes::install_cran("covr")
shell: Rscript {0}
The above snippet fixed my issue because I wanted to depend on a future dplyr version. You can view the full yaml file here.

Know which (exact) R version a package was built under?

How can we tell precisely which R version an R package was built under?
Example
In the RSelenium package's DESCRIPTION file here, we see
Depends:
R (>= 3.0.0)
But this does not appear to be precise (due to the > symbol)
Notes
Karl Browman's site says that:
Depends is used to indicate dependency on a particular version of R, and on packages that are to be loaded (with library()) whenever your package is loaded. If you expect that users would want to load that other package whenever they loaded yours, then you should include the package name here. But this is now relatively rare. (I think the namespaces for these packages should also be imported, with #import.)
It almost never matters which version built a package. The only thing that usually matters is which version installed it. (Binary packages are images of installed packages, so it matters for them.)
The version that installed a package is stored in the Built: field in the DESCRIPTION file. (Yes, "Built", not "Installed".)
You can see it using code like
read.dcf(system.file("DESCRIPTION", package="base"), fields="Built")
#> Built
#> [1,] "R 3.6.1; ; 2019-07-06 02:01:41 UTC; unix"
Put in your own package name instead of "base".
The exception for the "almost never matters" is on those rare occasions when the package format changes.

R package listed on CRAN but not in available package

I want to install a package that is listed in https://cran.r-project.org/web/packages/available_packages_by_name.html as available in CRAN, but when I check in R the install packages menu or the available.packages() command, I can't see the package there.
Do I need to do something different to install those packages? Why aren't those packages available?
The packages I'm interested on are WikipediR ( https://cran.r-project.org/web/packages/WikipediR/index.html ), WikidataR and WikipediaR.
If it matters, I'm using R 2.15.0 in Windows XP.
See the documentation for ?available.packages...
By default, the return value includes only packages whose version and
OS requirements are met by the running version of R, and only gives
information on the latest versions of packages.
In other words... your R 2.15 is likely too old for the package you are looking to download.
You can try to download the package source manually add the package to the package library usually found somewhere like "win-library/2.15/" but like Cory mentioned it is likely that the older version of R does not support the package build.
The advice given so far is a bit incomplete although I do agree you need to update your R version if you want to use these packages. Looks like they don't need compilation so you might have been able to either install from a local copy or drop R code in, but critically they depend on httr which requires R 3.0.0 or above. They were released only relatively recently, so there will be no Windows binaries from back in 2012. (Your copy of R is from 30-Mar-2012.) Look in the DESCRIPTION file which is presented in a nice web format at the CRAN/package listing:
https://cran.r-project.org/web/packages/WikidataR/index.html
Imports: httr, jsonlite, WikipediR
Suggests: testthat, knitr, pageviews
# only one version of these two
https://cran.r-project.org/src/contrib/Archive/WikidataR/WikidataR_1.0.0.tar.gz
https://cran.r-project.org/src/contrib/Archive/WikipediaR/WikipediaR_1.0.tar.gz
# pick one of these
https://cran.r-project.org/src/contrib/Archive/WikipediR/

install other packages when creating new package in R

I created a R package called myPackage. In that package I've used other packages, such as, RJSONIO, stringr, RSQLite and Rcpp. I want to install all of those packages when I am installing myPackage, if it is not installed before.
Is this possible?
You can specify a list of packages in the DEPENDS section of your DESCRIPTION file. From the linked documentation file
The ‘Depends’ field gives a comma-separated list of package names
which this package depends on. The package name may be optionally
followed by a comment in parentheses. The comment should contain a
comparison operator, whitespace and a valid version number. You can
also use the special package name ‘R’ if your package depends on a
certain version of R — e.g., if the package works only with R version
2.11.0 or later, include ‘R (>= 2.11.0)’ in the ‘Depends’ field. You can also require a certain SVN revision for R-devel or R-patched, e.g.
‘R (>= 2.14.0), R (>= r56550)’ requires a version later than R-devel
of late July 2011 (including released versions of 2.14.0). Both
library and the R package checking facilities use this field: hence it
is an error to use improper syntax or misuse the ‘Depends’ field for
comments on other software that might be needed. Other dependencies
(external to the R system) should be listed in the
‘SystemRequirements’ field, possibly amplified in a separate README
file. The R INSTALL facilities check if the version of R used is
recent enough for the package being installed, and the list of
packages which is specified will be attached (after checking version
requirements) before the current package, both when library is called
and when preparing for lazy-loading during installation.
There are other related sections, such as IMPORTS and SUGGESTS - see the docs for details.
Have a look at some of the R-packages on r-forge to get an idea.

Resources