Skip to content

Instantly share code, notes, and snippets.

@MilesMcBain
Last active August 9, 2019 07:50
Show Gist options
  • Save MilesMcBain/519e31e0c68e2fba63e0f16dd763037f to your computer and use it in GitHub Desktop.
Save MilesMcBain/519e31e0c68e2fba63e0f16dd763037f to your computer and use it in GitHub Desktop.
Renv notes:

Set up library

  1. renv::init(bare = TRUE)

  2. renv::deactivate()

  3. renv::install(renv::dependencies("./packages.R")$Package)

Errors on GitHub only packages.

renv::hydrate(renv::dependencies("./packages.R")$Package,
                library = "./renv/library/R-3.6/x86_64-w64-mingw32/")

Why is path so long?

It would be cool if hydrate had the option to append to a library, rather than overwrite?

ISSUE: If you accidently call hydrate without library it copies from user library to system library (undesirable)?

BUG: renv::hydrate() alters .libpPaths() removing user library.

Need to restart session after this due to bug atm.

Run my project

  withr::with_libpaths(new = c(fs::path_abs("./renv/library/R-3.6/x86_64-w64-mingw32/"),
                                "c:/R/R-3.6.0/library"), 
                        code = drake::r_make())

Snapshot my library

  1. renv::snapshot() failed with:
Error in renv_renvignore_pattern(path, root) : reached elapsed time limit
Traceback (most recent calls first):
18: renv::snapshot()
17: renv_snapshot_filter(project, records, type)
16: renv_snapshot_filter_packrat(project, records)
15: (function() {
        setTimeLimit(elapsed = timeout, transient = TRUE)
        on.exit(setTimeLimit(), add = TRUE)
        dependencies(project)
    })()
14: dependencies(project)
13: renv_dependencies_discover(path, path)
12: renv_dependencies_discover_dir(path, root)
11: lapply(children, renv_dependencies_discover, root = root)
10: FUN(X[[i]], ...)
 9: renv_dependencies_discover_dir(path, root)
 8: lapply(children, renv_dependencies_discover, root = root)
 7: FUN(X[[i]], ...)
 6: renv_dependencies_discover_dir(path, root)
 5: lapply(children, renv_dependencies_discover, root = root)
 4: FUN(X[[i]], ...)
 3: renv_dependencies_discover_dir(path, root)
 2: renv_dependencies_discover_dir_children(path, root)
 1: renv_renvignore_pattern(path, root)
  1. renv::snapshot(type = "simple", library = fs::path_abs("./renv/library/R-3.6/x86_64-w64-mingw32/"))

Works okay!

Restore my library

  1. TODO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment