gmbecker / gran Goto Github PK
View Code? Open in Web Editor NEWRepository-based tools for reproducibilty at the system-wide installation and individual analysis levels for R
Repository-based tools for reproducibilty at the system-wide installation and individual analysis levels for R
The package vignette fails in windows, in the step makeSingleGRANRepo()
.
I traced the first problem to normalizePath2()
, where the code makes some assumptions about path names that don't seem to hold for Windows.
Reproducible example:
repdir = file.path(tempdir(), "repos")
> normalizePath2(repdir)
[1] "C:/Users/Andrie/Documents/GitHub/gRAN/C:\\Users\\Andrie\\AppData\\Local\\Temp\\RtmpszdDv8/repos"
Note the ..../gRAN/C::\\Users\\...
If I rewrite normalizePath2()
by commenting out four lines toward the bottom, this problem goes away on Windows, but I don't know what the impact will be on other operating systems.
normalizePath2 = function(path, follow.symlinks=FALSE)
{
if(follow.symlinks)
normalizePath(path)
else {
path <- path.expand(path)
fileSep <- .Platform$file.sep
wd <- getwd()
if(substr(path, 1, 1) == "~")
path = path.expand(path)
##paths starting with / for example
else if(substr(path, 1, 1) == fileSep)
path = path
else if (substr(path, 1, 2) == "..") {
tmppath = wd
while(substr(path, 1, 2) == "..") {
tmppath = dirname(tmppath)
path = substr(path, 3, nchar(path))
if(substr(path, 1, 1) == fileSep)
path = substr(path, 2, nchar(path))
}
path = file.path(tmppath, path)
}
# else if(grepl("^\\.*[[:alnum:]]", path))
# path = file.path(wd, path)
# else if (substr(path, 1,1) == ".")
# path = file.path(wd, substr(path,2, nchar(path)))
path = gsub(paste(rep(fileSep, 2), collapse=""), fileSep, path, fixed=TRUE)
path
}
}
In the function GRANonGRAN()
the following lines fail:
res = file.copy(system.file("GRAN", package="GRANBase"),
normalizePath2(repobase(repo)), recursive=TRUE,
overwrite=TRUE)
if(any(!res))
stop("copy failed")
The reason is that the file "GRAN" doesn't seem to exist in GRANbase
system.file("GRAN", package="GRANBase")
[1] ""
Should this line refer to a different folder?
Thanks for joining @cboettig and I at cboettig/nonparametric-bayes#55 (comment) I wonder if you could advise me if I've got the right idea here:
I've got your package on my computer with this...
# needed to build the vignette
source("http://bioconductor.org/biocLite.R")
biocLite("BiocStyle")
# get the package from github and build the vingette, takes a minute or two
devtools::install_github("gmbecker/gRAN", build_vignettes = TRUE)
Now I'm doing some work, for example...
# do some work, for example with these packages...
library(MASS)
library(gender)
# ... do various analyses...
Now I want to capture my working environment by getting the packages currently used by my R session for this analysis and store them locally where I can have a compendium that includes my R scripts and a nearby directory with the versions of the packages used in those scripts. Am I on the right track with this next bit?
# gets the CRAN packages of the packages in currently attached and stores
# them locally. You'd do this at the end of an analysis when all the libraries
# you've used are loaded in the environment, ie. at the end of a Rmd file.
path <- getwd() # where the packages will be downloaded to
my_local_repo <- "my_local_repo" # name of local repo
session_packages <- sessionRepo(sessionInfo(), repo_dir = path, dir = path,
libloc = path,
stoponfail = FALSE, # skip github pkgs, not supported
replace = TRUE, # update previous virtual repository
name = "my_local_repo") # give it a name
# Now we have a local repository of packages that match the ones used
# for this analysis. Let's say we archive all of this somewhere, ready to return to
# some time later.
Time passes... we want to go back to that work we did earlier and install those local old packages into our current env...
# Now I want I want to draw on this local repository
# to load the same libraries that were used to generate the archive. We don't
# want to download them again because we might not have good internet access,
# or we're not sure they'll still be online, etc. So let's install packages
# from this local repository that we just created in the previous line.
# Assuming we are in the project directory, and that we have saved
# `session_packages` somewhere when we did the earlier work...
# get the paths to each individual package
session_packages_paths <- list.files(session_packages, full.names = TRUE)
# make a directory for the local library
my_local_library <- paste0(getwd(), "/my_local_library")
# install the packages to that local library, have to respond with 'y'
# at the prompts to create a personal library:
install.packages(session_packages_paths,
repos = NULL,
type =" source",
lib = my_local_library)
# inspect the current session
sessionInfo()
# inspect the local custom library
library(lib.loc = my_local_library)
I'm not sure what's going on here, do I now have those old local packages installed in my current env, is that correct? Is this the right way about it, or is there a simpler way?
thanks!
First of: kudos for trying to ensure reproducibility!
Forgive me if I might have overlooked it, but I think you forgot to document some prerequisites that must be met in order to get your package up and running.
After reading your post and trying to install
gRAN (or GRANBase as it's called in your post?), I experienced the following issues due to missing package dependencies:
BiocInstaller
needs to be installed first.
BiocStyle
needs to be installed first.
After installing these packages, I still get the following error:
Error: processing vignette 'GRAN-Overview.Rnw' failed with diagnostics:
chunk 3
Error in GRANonGRAN(repo) : copy failed
Execution halted
This is the code I ran:
source("http://bioconductor.org/biocLite.R")
biocLite("BiocInstaller")
biocLite("BiocStyle")
require("devtools")
install_github("gRAN", "gmbecker")
My sessionInfo()
:
R version 3.1.1 (2014-07-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252
[3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
[5] LC_TIME=German_Germany.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] BiocInstaller_1.14.2 devtools_1.5
loaded via a namespace (and not attached):
[1] digest_0.6.4 evaluate_0.5.5 httr_0.4 memoise_0.2.1
[5] packrat_0.4.0.4 parallel_3.1.1 RCurl_1.95-4.3 stringr_0.6.2
[9] tools_3.1.1 whisker_0.3-2
In the commit 5eee55e
the function .to_gran_url was added which adds the code:
stopifnot(grepl(dest_base(repo), path, fixed = TRUE))
In buildBadge, if (is.na(status) || status == "NA"), log/path = "" so this will always hit the stop case and can prevent useful subsequent functionality in makeRepo like saveRepo. Could a more lenient response than stopping be taken in general?
install_git("https://github.com/gmbecker/gRAN")
...
Error in texi2dvi(file = file, pdf = TRUE, clean = clean, quiet = quiet, :
pdflatex is not available
Error in running tools::texi2pdf()
Warning messages:
1: running command 'R_LIBS_USER=/tmp/RtmprzUi6o/repos/stable/LibLoc R CMD build /tmp/RtmprzUi6o/repos/tmpcheckout/GRAN/./. --resave-data' had status 1
2: In buildBranchesInRepo(repo, temp = FALSE, incremental = FALSE, :
Warning: not all packages were succesfully built
3: running command 'R_LIBS='/tmp/RtmprzUi6o/repos/stable/LibLoc' R CMD check toypkg_1.0.tar.gz' had status 1
Warning in removeNodes.list(kids) :
removeNode only works on internal nodes at present
Warning in removeNodes.list(kids) :
removeNode only works on internal nodes at present
Warning in read.dcf(file = tmpf) :
cannot open compressed file '/tmp/RtmprzUi6o/repos/stable/src/contrib/PACKAGES', probable reason 'No such file or directory'
Error: processing vignette 'GRAN-Overview.Rnw' failed with diagnostics:
chunk 4
Error in read.dcf(file = tmpf) : cannot open the connection
Execution halted
Error: Command failed (1)
@gmbecker Currently the staging/ directory is wiped when the builds complete (migrateToFinalRepo()) so those products are not available for troubleshooting. We'd like to instead cleanse staging/ in makeRepo() when the builds start. If you don't see a problem with this I'll submit a pull request.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.