R devtools: Dependency package document not available
Hi I'm following a tutorial here from Hilary and here from Hadley Wickham trying to create a dummy.
However, my package needs some external dependencies XML
and RCurl
in this case, when I run the command document it will complain that:
> setwd('/home/datafireball/projects/Rprojects/rgetout/rgetout')
> document()
Error: could not find function "document"
> library(devtools)
> document()
Updating rgetout documentation
Loading rgetout
Loading required namespace: XML
Error in (function (dep_name, dep_ver = NA, dep_compare = NA) :
Dependency package XML not available.
>
Here is my file DESCRIPTION
.
Package: rgetout
Title: A R package to get all the outlinks for a given URL
Version: 0.1
Authors@R: "Eric Cartman <Eric.Cartman@gmail.com> [aut, cre]"
Description: This package is intended to include as much web extraction functionality as much as possible. It starts with one function. getout will extract
all the outlinks for a given URL with a user-agent that you can customize.
Depends: R (>= 3.0.2)
Imports:
XML,
RCurl
License: MIT
LazyData: true
Here is the source code of the GitHub repo if you'd like more information.
source to share
It is assumed that you will have the necessary tools / dependencies to develop the package when you do this.
utils::install.packages
has a dependencies argument that will try to install remote packages that package / depends on (depending on how they depend (suggests / depends / linkingTo).
devtools::install_github
will work in a similar way.
Installing a package and documenting it as a development component are quiet different steps.
source to share
If you have problems with this, even if you have packages installed and downloaded, I suggest you do the following.
- Delete
Imports:
andSuggests:
record your fileDESCRIPTION
. - Make sure you have devtools working with
library(devtools)
- Now start adding libraries to your file
DESCRIPTION
by running the following command on your console:devtools::use_package("dplyr")
for whateverImports:
you need. Repeat this step for each library you need.
In my case, it dplyr
was the one who refused to boot. You can decide where will be located the package by running: devtools::use_package("dplyr", "Suggests")
.
source to share