R devtools::install_github / install_bitbucket - vignettes not installed when not building - r

I have a R package on bitbucket including built vignettes in doc folder. Building the vignettes requires access to local database, therefore the user cannot built the vignette at his/her machine. Although it says
** installing vignettes
during
devtools::install_bitbucket("uniks_ines/dexr#default", build=F)
vignettes' HTML files are not copied to the library location, and browseVignettes("dexR") gives
No vignettes found by browseVignettes("dexR")
Any idea why vignettes are not installed?

If you check out the help page for the function (?remotes::install_bitbucket), you'll see in the "Usage" section that the default value for the build_opts argument is
build_opts = c("--no-resave-data", "--no-manual", "--no-build-vignettes")
You can solve your problem via
library(devtools)
install_bitbucket("uniks_ines/dexr#default",
build_opts = c("--no-resave-data", "--no-manual"))
The changes I have made to your initial command are removing build = FALSE and removing the "--no-build-vignettes" element of the build_opts vector.

Related

How to install R package with its vignettes from source via RStudio `Install and Restart` button?

I've downloaded the source code of an R package (You may use this R package by git-cloneing or downloading zipped version). I want to install the package via the Install and Restart button (4) in the Build tab (1). In configuration (2) I selected "Vignettes" (3).
Other configuration options I use:
Unfortunately, when I press Install and Restart, the package is installed but without its vignettes,i.e., no vignettes in the package's help page are displayed:
When I install the same package from CRAN, the vignettes are present:
Question: Is there a way to install a package with its vignettes by using this Install and Restart button. Maybe some configuration options are missing?
I use RStudio 1.3.1091, R 4.0.2 on Windows 10.
Update:
I'm aware of the solutions like:
devtools::install_github("r-lib/pkgdown", build_vignettes = TRUE)
Or in the Terminal window:
R CMD build .
R CMD INSTALL pkgdown_1.6.1.9000.tar.gz
But my question is about the functionality of the Install and Restart button (or similar tools in RStudio).
I installed this package in RStudio using devtools::install_github("r-lib/pkgdown", build_vignettes = TRUE). The vignettes are installing using this method.
vignette(package = "pkgdown")
Vignettes in package ‘pkgdown’:
linking Auto-linking (source, html)
pkgdown Introduction to pkgdown (source, html)
metadata Metadata (source, html)
search Search (source, html)
Furthermore, vignette("pkgdown") brings up the main vignette for the package. However, the help documentation landing page for the package appears to have been updated to no longer link to the vignettes.
Report this as a potential issue: https://github.com/r-lib/pkgdown/issues
If the vignettes are not installing when using RStudio's menu- and GUI-based approach, perhaps the issue is a bug in RStudio and not in the package.

After building a package, where is its zip file?

I have developed a very simple basic package called : mypackage in windows environment which contains one function
na2zero()
in R-Studio IDE i just did Build --> Clean and Rebuild resulted into below logs
==> Rcmd.exe INSTALL --preclean --no-multiarch --with-keep.source package
* installing to library 'C:/Users/NAME/Documents/R/R-4.0.0/library'
* installing *source* package 'mypackage' ...
** using staged installation
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
converting help for package 'mypackage'
finding HTML links ... hello html
na2zero html
done
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (mypackage)
i'm able to invoke the functions which resides in mypackage, but my question is, i want to see the location of the package, i believe the extension will be .zip
so in which folder the package (mypackage) exists.?
In RStudio, the "Install and Restart" menu item in the Build pane will install the package directly into R, without creating an archive file.
If you want to create an archive, there are two kinds of those. Use "Build Source Package" (in the "More..." menu) to create a .tar.gz file, which can be installed in any current version of R, and also some past and future ones, on any supported platform.
Use "Build Binary Package" to create a binary package. On Windows, that would be a .zip file. It is only good for Windows and a very small range of R versions (typically if you build in R version X.Y.Z, you'll be able to use it for different value of Z, but not different values of X or Y). You won't be able to use it on Linux or MacOS.
For a simple package, you should almost always use the "Source Package" format. Only when you have compiled code (C, C++, Fortran) is it a good idea to use the "Binary Package" format: your users may not have the compiler needed to install it themselves. But you'll need to match your users' R versions very carefully.
For both Source and Binary packages, RStudio will put the archive file in the same folder as your package source is in, e.g. if your package version 1.0.0 is in
path/to/mypackage, it will produce path/to/mypackage_1.0.0.zip.

roxygen2 not creating .Rd documentation

I am unable to generate .Rd documentation files for my package using RStudio and Roxygen2. First, let me mention that I have gone through similar problems posted here and have already done the following:
Roxygen2 blocks initiated at the beginning of file with a #'
Configured Build Tools>Checked generate documentation with Roxygen> Configure > Checked all fields under 'Use roxygen to generate' and 'Automatically roxygenize when running'
Made sure there were no .Rd files in the 'man' folder
And even after that, when I perform a 'Build and Reload' on RStudio I get the following output (please note the line that reads: No man pages found in package MYPACKAGE:
=
=> devtools::document(roclets=c('rd', 'collate', 'namespace', 'vignette'))
>
Updating MYPACKAGE documentation
Loading MYPACKAGE
Documentation completed
==> Rcmd.exe INSTALL --no-multiarch --with-keep.source MYPACKAGE
installing to library C:/Users/user/Documents/R/win-library/3.3
installing source package 'MYPACKAGE' ...
** R
** data
* moving datasets to lazyload DB
** preparing package for lazy loading
No man pages found in package 'MYPACKAGE'
** help
* installing help indices
** building package indices
** testing if installed package can be loaded
DONE (MYPACKAGE)
Edit:
Upon further investigation, it appears that this was caused by the fact that I have sub-directories within my R directory, which is not supported by default. A possible solution was located here which, however, I haven't yet tried out. I will report back with the outcome as soon as I am able to perform the tests.
I had the same error. roxygen2 was creating correctly the md files in the /man directory but they were not found at compilation time. I had the following error.
No man pages found in package
After a bit of time I found that in one of the R file I had a source statement
source("C:/Users/vaulot/Google Drive/Scripts/R library/dv_function_pr2.R")
My guess is that there was some code in the source file interfering with roxygen2.

Loading dependencies from package-internal packrat library

I am building an R package with packrat. The package is fully tested and installation from the locally saved source file by
install.packages("myPackage.tar.gz", repos = NULL, type = "source")
works if all dependencies (specified in the Imports: field) are installed on the local machine.
However, I would like to install that package on another server where dependencies are not installed. When I try to do this, I get the error
"ERROR: dependencies ‘survey’, ‘dplyr’ are not available for package 'myPackage'"
I also tried to install the packrat bundle which I created by calling
packrat::bundle(project = 'pathtomypackageproject', file = 'myPackage.tar.gz',
include.lib = TRUE)
but I get the same error.
I think the problem is that, upon installing 'myPackage', R searches the first element of .libPaths(), doesn't find anything and since "repos = NULL" is specified, has nowhere to install the packages from so the error is thrown.
A solution I'm still trying to avoid is to transfer a repository containing all dependencies to the server and pointing to the repository when installing the package. Ideally, I only have to transfer myPackage.tar.gz.
My question is if there is some way to point to the internal packrat library, where all dependencies can be found, and import the namespaces from there.
If you have included the list of packages to be imported in DESCRIPTION File, then you just need to do this while installation of your package:
install.packages("myPackage",dependencies=TRUE)

Building R package: "No man pages found in package"

My previously-functioning R package lllcrc recently broke, so I tweaked it, and now I'm having trouble building it again because it acts like it can't see my documentation files:
R CMD INSTALL lllcrc
* installing to library ‘/home/[...]/3.1’
* installing *source* package ‘lllcrc’ ...
** R
** preparing package for lazy loading
** help
No man pages found in package ‘lllcrc’
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (lllcrc)
This is totally weird because I definitely have a complete set of .Rd files in the man folder; in fact, I generated all of these using roxygen2, and all of this worked previously. The R CMD INSTALL even works enough so that the package actually installs and all of its examples run. But documentation is missing. Running ?foo just gives a "no documentation" message.
Another thing: R CMD Rd2pdf lllcrc generates the .pdf documentation as I would expect.
Any ideas?
I just had the same error message ... if you are using roxygen and RStudio then your problem might be the same. The reason became apparent when looking at "Configure build tools" in the "Build" drop-down menu: you need to tick the checkbox "Generate documentation with Roxygen". After that, everything worked.

Resources