Vectorization of the install_github function from devtools package in R - r

I am using devtools package to install R packages from GitHub. In the function's manual there is a sentence about repo parameter that the function is vectorized on that parameter
This function is vectorised on repo so you can install multiple packages in a single command.
I've created 5 packages and I distribute them on a single github repository in 5 different subdirectories. When I use such command to install all 5 of them in a single function call
> if (!require(devtools)) {
+ install.packages("devtools")
+ require(devtools)
+ }
> install_github(paste0("mi2-warsaw/RTCGA.data/",
+ subdir = paste0("RTCGA.",
+ c("clinical",
+ "rnaseq",
+ "mutations",
+ "cnv",
+ "PANCAN12")
+ )
+ )
+ )
Downloading github repo mi2-warsaw/RTCGA.data#master
Installing RTCGA.clinical
"C:/PROGRA~1/R/R-32~1.0/bin/x64/R" --no-site-file --no-environ \
--no-save --no-restore CMD INSTALL \
"C:/Users/Marcin/AppData/Local/Temp/RtmpeSTVOR/devtoolse483660419b/mi2-warsaw-RTCGA.data-f38f079/RTCGA.clinical" \
--library="C:/Users/Marcin/Documents/R/win-library/3.2" \
--install-tests
* installing *source* package 'RTCGA.clinical' ...
** R
** data
*** moving datasets to lazyload DB
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
*** arch - i386
*** arch - x64
* DONE (RTCGA.clinical)
Downloading github repo mi2-warsaw/RTCGA.data#master
Installing RTCGA.rnaseq
"C:/PROGRA~1/R/R-32~1.0/bin/x64/R" --no-site-file --no-environ \
--no-save --no-restore CMD INSTALL \
"C:/Users/Marcin/AppData/Local/Temp/RtmpeSTVOR/devtoolse4839392db6/mi2-warsaw-RTCGA.data-3c044a0/RTCGA.rnaseq" \
--library="C:/Users/Marcin/Documents/R/win-library/3.2" \
--install-tests
* installing *source* package 'RTCGA.rnaseq' ...
** R
** data
*** moving datasets to lazyload DB
it looks like for each single package's installation the whole repository is downloaded. So in a result the whole repository is downloaded 5 times...
Is there a way to download the repository once, and to install 5 packages then - if possible - in a one function call similar to the one I am using?

Related

How to exclude package in R from downloading automatically?

I am trying to download the GGMAP package in R. during installation, it also downloads ggplot 2.1.0. I am getting an error, however, that the ggplot version required by ggmap is 2.2.0. How do I force ggplot to be the latest version?
> library(devtools)
> install_github("dkahle/ggmap")
Downloading GitHub repo dkahle/ggmap#master
from URL https://api.github.com/repos/dkahle/ggmap/zipball/master
Installing ggmap
"C:/PROGRA~1/MIE74D~1/RCLIEN~1/R_SERVER/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL \
"C:/Users/dixi/AppData/Local/Temp/RtmpuYriTy/devtools2604499b1ebd/dkahle-ggmap-065fe6a" \
--library="C:/Users/dixi/Documents/R/win-library/3.3" --install-tests
* installing *source* package 'ggmap' ...
** R
** data
*** moving datasets to lazyload DB
** inst
** tests
** preparing package for lazy loading
Error : package 'ggplot2' 2.1.0 was found, but >= 2.2.0 is required by 'ggmap'
ERROR: lazy loading failed for package 'ggmap'
* removing 'C:/Users/dixi/Documents/R/win-library/3.3/ggmap'
* restoring previous 'C:/Users/dixi/Documents/R/win-library/3.3/ggmap'
Error: Command failed (1)

I'm having some trouble to install the tscompdata package in my r

I'm trying to install the tscompdata package to R. This is a new one.
The installation is by the "devtools" package, using the following command:
devtools::install_github("robjhyndman/tscompdata")
and the output is:
Downloading GitHub repo robjhyndman/tscompdata#master from URL
https://api.github.com/repos/robjhyndman/tscompdata/zipball/master
Installing tscompdata '/usr/lib/R/bin/R' --no-site-file --no-environ
--no-save --no-restore --quiet CMD INSTALL \ '/tmp/RtmpjrsG7p/devtools45d14034ea55/robjhyndman-tscompdata-0329cec'
\ --library='/home/diego/R/x86_64-pc-linux-gnu-library/3.4'
--install-tests
* installing *source* package ‘tscompdata’ ...
** R
** data
*** moving datasets to lazyload DB
** byte-compile and prepare package for lazy loading Error : object ‘mstl’ is not exported by 'namespace:forecast' ERROR: lazy loading
failed for package ‘tscompdata’
* removing ‘/home/diego/R/x86_64-pc-linux-gnu-library/3.4/tscompdata’ Installation failed: Command failed (1)
did someone face this problem too?

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.

No vignettes found by browseVignettes where they actually are there

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

R library(qdap) installation error

I am having difficulty installing the qdap library, see below:
I installed the Java library first, and then the qdap library:
Sys.setenv(JAVA_HOME='C:\Program Files (x86)\Java\jre7')
library(rJava)
then the devtools library:
library(devtools)
install_github("trinker/qdapDictionaries")
install_github("trinker/qdapRegex")
install_github("trinker/qdapTools")
install_github("trinker/qdap")
The other installations before qdap go fine, but at qdap this error is generated:
install_github("trinker/qdap")
Downloading github repo trinker/qdap#master
Installing qdap
Skipping 3 packages ahead of CRAN: qdapDictionaries, qdapRegex, qdapTools
"C:/PROGRA~1/R/R-32~1.1/bin/x64/R" --no-site-file --no-environ --no-save --no-restore \
CMD INSTALL \
"C:/Users/Seema/AppData/Local/Temp/RtmpMdVHCQ/devtools101432a84788/trinker-qdap-85cbe87" \
--library="C:/Users/Seema/Documents/R/win-library/3.2" --install-tests
installing source package 'qdap' ...
** R
** data
*** moving datasets to lazyload DB
** inst
** tests
** preparing package for lazy loading
Error occurred during initialization of VM
Unable to load native library: Can't find dependent libraries
Error: Command failed (1)
What dependent libraries is it looking for? Any help highly appreciated.

Resources