No vignettes found by browseVignettes where they actually are there - r

I have a package on a github repository with 2 vignettes in the vignettes/ directory.
I tried to download if with devtools package like this
> if (!require(devtools)) {
+ install.packages("devtools")
+ require(devtools)
+ }
> install_github("MarcinKosinski/RTCGA", build_vignettes=TRUE)
Downloading github repo MarcinKosinski/RTCGA#master
Installing RTCGA
"D:/R-32~1.2/bin/x64/R" --no-site-file --no-environ --no-save --no-restore CMD INSTALL \
"C:/Users/Marcin/AppData/Local/Temp/Rtmpg1Kbfy/devtools3cf47f1f6731/MarcinKosinski-RTCGA-0d91d7c" \
--library="C:/Users/Marcin/Documents/R/win-library/3.2" --install-tests
* installing *source* package 'RTCGA' ...
** R
** tests
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (RTCGA)
Reloading installed RTCGA
Welcome to the RTCGA (version: 0.99.6).
but when I try to browse Vignettes it appears they were not build.
> library(RTCGA)
> browseVignettes("RTCGA")
No vignettes found by browseVignettes("RTCGA")
I've seen some old issue where people suggested to use build_vignettes=TRUE, but as you see it didn't help OR to add move Vignettes to remove inst/doc/ directory from .Rbuildignore file. But this must be and old issue, because I haven't seen such directory in a binary source after installation of the package.
I've also seen this answer on a similar question, but when I built source and then install package from a source it appears to have the same issue: No vignettes found by browseVignettes("RTCGA").
Any idea on how to make this work?
EDIT
According to Martin's answer
I've addedthis fragment of code to vignettes' YAML
vignette: >
%\VignetteIndexEntry{Integrating TCGA Data - RTCGA Tutorial}
%\VignetteEngine{knitr::rmarkdown}
I've edited YAML of 2 of my vignettes
I've added code to the beggining of YAML - this file
Just in case I once added new information to the end of YAML - this file
but still there appears there are no vignettes available after installation from github
> devtools::install_github("MarcinKosinski/RTCGA")
Downloading github repo MarcinKosinski/RTCGA#master
Installing RTCGA
'/usr/lib/R/bin/R' --vanilla CMD INSTALL \
'/tmp/Rtmpk34Zbr/devtools531845716f54/MarcinKosinski-RTCGA-5571117' \
--library='/home/mkosinski/R/x86_64-pc-linux-gnu-library/3.2' --install-tests
* installing *source* package ‘RTCGA’ ...
** R
** tests
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (RTCGA)
> library(RTCGA)
Welcome to the RTCGA (version: 0.99.6).
> browseVignettes("RTCGA")
No vignettes found by browseVignettes("RTCGA")
EDIT 2
Of course I've forgoten to add parameter buildVignettes = TRUE but after this it looks like vignettes are seen but there is some problem with their compilation during build:
devtools::install_github("MarcinKosinski/RTCGA", build_vignettes=TRUE)
Downloading github repo MarcinKosinski/RTCGA#master
Installing RTCGA
'/usr/lib/R/bin/R' --vanilla CMD build \
'/tmp/RtmpA7il1Q/devtools5fc871b48f57/MarcinKosinski-RTCGA-e47bdf6' \
--no-resave-data --no-manual
* checking for file ‘/tmp/RtmpA7il1Q/devtools5fc871b48f57/MarcinKosinski-RTCGA-e47bdf6/DESCRIPTION’ ... OK
* preparing ‘RTCGA’:
* checking DESCRIPTION meta-information ... OK
* installing the package to build vignettes
* creating vignettes ... OK
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
Removed empty directory ‘RTCGA/ghPage’
Removed empty directory ‘RTCGA/inst’
* building ‘RTCGA_0.99.6.tar.gz’
'/usr/lib/R/bin/R' --vanilla CMD INSTALL \
'/tmp/RtmpA7il1Q/RTCGA_0.99.6.tar.gz' \
--library='/home/mkosinski/R/x86_64-pc-linux-gnu-library/3.2' \
--install-tests
* installing *source* package ‘RTCGA’ ...
** R
** tests
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
Warning in file(con, "w") :
cannot open file '/home/mkosinski/R/x86_64-pc-linux-gnu-library/3.2/RTCGA/doc/index.html': No such file or directory
Error in file(con, "w") : cannot open the connection
ERROR: installing vignettes failed
* removing ‘/home/mkosinski/R/x86_64-pc-linux-gnu-library/3.2/RTCGA’
* restoring previous ‘/home/mkosinski/R/x86_64-pc-linux-gnu-library/3.2/RTCGA’
Error: Command failed (1)

From Writing R Extensions, section 1.4.2, your vignettes need to have a line
%\VignetteEngine{knitr::knitr}
in them; a common paradigm is to add the following to the yaml at the top of the vignette
vignette: >
%\VignetteIndexEntry{Integrating TCGA Data}
%\VignetteEngine{knitr::rmarkdown}
VignetteIndexEntry provides a convenient title for R's help system. Remember the BiocStyle package for creating vignettes with a consistent look.

I only could solve this, using:
devtools::build_vignettes()
Of course, then uploading the new files by git

Related

Cannot mannually install package in R

I am trying to install package using:
library(devtools)
install_github("s-conner/rmtl/rpackage")
However, I got error:
Error: Failed to install 'RMTL' from GitHub:
schannel: failed to receive handshake, SSL/TLS connection failed
Any advise, please?
It installs fine for me (on Linux). As the output shows, I also have a GITHUB_PAT but I do not think that should be required for a public repository.
$ installGithub.r s-conner/rmtl/rpackage
Using github PAT from envvar GITHUB_PAT
Downloading GitHub repo s-conner/rmtl#HEAD
── R CMD build ────────────────────────────────────────────────────────────────────────────
✔ checking for file ‘/tmp/remotes16a2746ead7197/s-conner-rmtl-c2fb188/rpackage/DESCRIPTION’ ...
─ preparing ‘rmtl’:
✔ checking DESCRIPTION meta-information ...
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
Omitted ‘LazyData’ from DESCRIPTION
─ building ‘rmtl_0.0.0.9000.tar.gz’
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
* installing *source* package ‘rmtl’ ...
** using staged installation
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** 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 (rmtl)
$
(where installGithub.r is a simple convenience wrapper for remotes::install_github from my littler CRAN package.)
So I guess you need to work out why the https handshake to GitHub fails for you. It would seem that GitHub serves the repository just fine.
you can also source the 3 functions in the package at the start of your code
devtools::source_url("https://raw.githubusercontent.com/s-conner/rmtl/master/rpackage/R/cif.R")
devtools::source_url("https://raw.githubusercontent.com/s-conner/rmtl/master/rpackage/R/rmtl.R")
devtools::source_url("https://raw.githubusercontent.com/s-conner/rmtl/master/rpackage/R/rmtl_mod.R")
You can also download the 3 r scripts files and source them
source("path/to/rmtl.R")

Error 404 installing R package from public github repro

I am trying to install the gaRdenbox package from github (https://github.com/KTMD-plant/gaRdenbox)
But when I run
install_github("KTMD-plant/gaRdenbox")
it returns
Error: Failed to install 'unknown package' from GitHub:
HTTP error 404.
Not Found
Did you spell the repo owner (KTMD-plant) and repo name (gaRdenbox) correctly?
-If spelling is correct, check that you have the required permissions to access the repo.
As far as I can see the repro is public. Do you have any idea what is the issue here?
This is a bug in package gaRdenbox as the file DESCRIPTION is 'missing' given that there is only a file Description.
You can test that by forking the package and altering the file by renaming it -- which I did in this fork in my repo. Now we can install as expected:
edd#rob:/tmp$ installGithub.r eddelbuettel/gaRdenbox
Using github PAT from envvar GITHUB_PAT
Downloading GitHub repo eddelbuettel/gaRdenbox#HEAD
✔ checking for file ‘/tmp/remotes12841a2d0cc36c/eddelbuettel-gaRdenbox-fd41a57/DESCRIPTION’ ...
─ preparing ‘gaRdenbox’:
✔ checking DESCRIPTION meta-information
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ building ‘gaRdenbox_0.0.1.0.tar.gz’
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
* installing *source* package ‘gaRdenbox’ ...
** using staged installation
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** 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 (gaRdenbox)
edd#rob:/tmp$
(where installGitHub.r is a simple wrapper for the command-line from my littler package). You can ignore the PAT message; I have one in my environment for other reasons.
I have filed a PR at the upstream repo.

Fail to build package when trying to install vignettes with install_github [R]

By default when one is using install_github function from devtools package in R the vignettes of the installed package are not build. I've seen this questio with an answer which shows how to build vignettes if one desires to
Building R package from github: how to disable building vignettes?.
I wrote a package with such vignettes and but I recieve an error what installing directly from github like this:
> devtools::install_github("MarcinKosinski/RTCGA")
Downloading github repo MarcinKosinski/RTCGA#master
Installing RTCGA
'/usr/lib/R/bin/R' --vanilla CMD INSTALL \
'/tmp/RtmpCIboSY/devtools17de96523e5/MarcinKosinski-RTCGA-e47bdf6' \
--library='/home/mkosinski/R/x86_64-pc-linux-gnu-library/3.2' \
--install-tests
* installing *source* package ‘RTCGA’ ...
** R
** tests
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (RTCGA)
> browseVignettes("RTCGA")
No vignettes found by browseVignettes("RTCGA")
> ?devtools::install_github
> devtools::install_github("MarcinKosinski/RTCGA", build_vignettes= TRUE)
Downloading github repo MarcinKosinski/RTCGA#master
Installing RTCGA
'/usr/lib/R/bin/R' --vanilla CMD build \
'/tmp/RtmpCIboSY/devtools17de1905fc71/MarcinKosinski-RTCGA-e47bdf6' \
--no-resave-data --no-manual
* checking for file ‘/tmp/RtmpCIboSY/devtools17de1905fc71/MarcinKosinski-RTCGA-e47bdf6/DESCRIPTION’ ... OK
* preparing ‘RTCGA’:
* checking DESCRIPTION meta-information ... OK
* installing the package to build vignettes
* creating vignettes ... OK
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
Removed empty directory ‘RTCGA/ghPage’
Removed empty directory ‘RTCGA/inst’
* building ‘RTCGA_0.99.6.tar.gz’
'/usr/lib/R/bin/R' --vanilla CMD INSTALL \
'/tmp/RtmpCIboSY/RTCGA_0.99.6.tar.gz' \
--library='/home/mkosinski/R/x86_64-pc-linux-gnu-library/3.2' \
--install-tests
* installing *source* package ‘RTCGA’ ...
** R
** tests
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
Warning in file(con, "w") :
cannot open file '/home/mkosinski/R/x86_64-pc-linux-gnu-library/3.2/RTCGA/doc/index.html': No such file or directory
Error in file(con, "w") : cannot open the connection
ERROR: installing vignettes failed
* removing ‘/home/mkosinski/R/x86_64-pc-linux-gnu-library/3.2/RTCGA’
* restoring previous ‘/home/mkosinski/R/x86_64-pc-linux-gnu-library/3.2/RTCGA’
Error: Command failed (1)
When I build package from source locally there are no errors. Can anyone know what can be a cause of this?
I needed to add
.onLoad <- function(libname, pkgname) {
vig_list = tools::vignetteEngine(package = 'knitr')
vweave <- vig_list[['knitr::knitr']][c('weave')][[1]]
vtangle <- vig_list[['knitr::knitr']][c('tangle')][[1]]
tools::vignetteEngine(pkgname, weave = vweave, tangle = vtangle,
pattern = "[.]Rmd$", package = pkgname)
#register_vignette_engines(pkgname)
}
this function to zzz.R file in R/ directory and knitr package to Dependencies in DESCRIPTION file.

R-package missing functions, but has documentation

My problem is when i build a package using devtools, or R CMD INSTALL -build the package builds, but when I install the resulting .zip (when I've tried binary builds) or .tar.gz
the functions in the package don't show up. I can SEE the functions in the .tar.gz when I unzip and the files are sufficiently large so as not to empty. ANY help appreciated.
what I'm using: Rstudio, R v 3.1.0
>install.packages("E:/R/Rpackage_meadq/meadq_1.0.4.tar.gz", repos = NULL, type = "source")
'\\AA.AD.EPA.GOV\ORD\RTP\USERS\A-D\dhall05\Net MyDocuments'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
* installing *source* package 'meadq' ...
** R
** data
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
*** arch - i386
*** arch - x64
* DONE (meadq)
>installed.packages()
...
meadq "3.1.0"
> library('meadq')
>ls('package:meadq')
character(0)
## to take an example function within package
> create_ont_csv()
Error: could not find function "create_ont_csv"
>?create_ont_csv
this pulls up the function documentation for create_ont_csv that's in the package
when I look at the "meadq_1.0.4.tar.gz" using winzip, I can see all the functions.
I've tried building in binary and the same thing happens where the functions are missing, but the documentation is there.
I've tried re-building a lot with this code and also R CMD INSTALL -build ... :
> library('devtools')
Attaching package: ‘devtools’
The following objects are masked from ‘package:utils’:
?, help
The following object is masked from ‘package:base’:
system.file
> build("E:/R/Rpackage_meadq/meadq")
"C:/PROGRA~1/R/R-31~1.0/bin/x64/R" --vanilla CMD build "E:\R\Rpackage_meadq\meadq" \
--no-manual --no-resave-data
* checking for file 'E:\R\Rpackage_meadq\meadq/DESCRIPTION' ... OK
* preparing 'meadq':
* checking DESCRIPTION meta-information ... OK
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
* looking to see if a 'data/datalist' file should be added
* building 'meadq_1.0.4.tar.gz'
[1] "E:/R/Rpackage_meadq/meadq_1.0.4.tar.gz"

ERROR: a 'NAMESPACE' file is required

I am trying to install some R packages on a Linux machine using
R CMD INSTALL -l <ourRlibrarylocation> <path where I saved the packagename.tar.gz file>
and I see an error message:
ERROR: a 'NAMESPACE' file is required
I am using R 3.0.1. Please help, I am new to R and just downloaded these packages for customers.
One example:
R CMD INSTALL -l /abcde/R/R-3.0.0/library /home/RFILES/PKG/UScensus2000tract_0.03.tar.gz
* installing *source* package âUScensus2000tractâ ...
ERROR: a 'NAMESPACE' file is required
* removing â/abcde/R/R-3.0.0/library/UScensus2000tractâ
According to the R documentation for writing extensions, all packages destined for version 3.0.0 and later must contain a NAMESPACE file. If you download an R package that gives you the above error, here's what you should try:
Untar the package:
tar -xvf the_package.tar.gz
Add a NAMESPACE file with the line exportPattern( "." ):
cd the_package
echo 'exportPattern( "." )' > NAMESPACE
cd ..
Re-tar the package:
tar -zcf the_package.tar.gz the_package
Try and install it again.
Hope that helps.
I actually just hit the same thing when compiling R-3.0.1. It looks to be that the package version that I was using was out of date. This was for proto:
# /var/local/R-3.0.1/bin/R CMD INSTALL -l /var/local/R-3.0.1/lib64/R/library proto_0.3-9.2.tar.gz
* installing *source* package ‘proto’ ...
ERROR: a 'NAMESPACE' file is required
* removing ‘/var/local/R-3.0.1/lib64/R/library/proto’
But there was a newer version for proto (0.3-10) which worked fine:
# ../var/local/R-3.0.1/bin/R CMD INSTALL -l ../var/local/R-3.0.1/lib64/R/library proto_0.3-10.tar.gz
* installing *source* package ‘proto’ ...
** package ‘proto’ successfully unpacked and MD5 sums checked
** R
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
‘proto.Rnw’
‘protoref.Rnw’
** testing if installed package can be loaded
* DONE (proto)
I had an older install of R (2.15), which the older proto package worked with:
# /var/local/R-2.15.0/bin/R CMD INSTALL -l /var/local/R-2.15.0/lib64/R/library proto_0.3-9.2.tar.gz
* installing *source* package 'proto' ...
** Creating default NAMESPACE file
** R
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
'proto.Rnw'
'protoref.Rnw'
** testing if installed package can be loaded
It looks like the older version of R actually creates the missing NAMESPACE file, but the new version bails. Hope this helps you!
I found the following link more useful:
How should I deal with "package 'xxx' is not available (for R version x.y.z)" warning?
6. The package is out of date
It may have been archived (if it is no longer maintained and no longer passes R CMD check tests).
In this case, you can load an old version of the package using install_version()
library(devtools)
install_version("foobarbaz", "0.1.2")
An alternative is to install from the github CRAN mirror.
library(devtools)
install_github("cran/foobarbaz")
One can now use remotes::install_url() or remotes::install_local().
It installs dependencies and generates the NAMESPACE file automatically.

Resources