|
| 1 | +## ---- eval=FALSE--------------------------------------------------------- |
| 2 | +# library(checkpoint) |
| 3 | +# checkpoint("2015-04-26", checkpointLocation = tempdir()) |
| 4 | + |
| 5 | +## ---- eval=FALSE--------------------------------------------------------- |
| 6 | +# library(checkpoint) |
| 7 | +# checkpoint("2015-04-26", checkpointLocation = tempdir()) |
| 8 | +# |
| 9 | +# library(MASS) |
| 10 | +# hist(islands) |
| 11 | +# truehist(islands) |
| 12 | + |
| 13 | +## ----setup, include=FALSE------------------------------------------------ |
| 14 | + |
| 15 | +## Create temporary project and set working directory |
| 16 | + |
| 17 | +example_project <- tempdir() |
| 18 | + |
| 19 | +dir.create(example_project, recursive = TRUE) |
| 20 | +unlink("~/.checkpoint/2015-04-26", recursive=TRUE) |
| 21 | +oldRepos <- getOption("repos") |
| 22 | +oldLibPaths <- .libPaths() |
| 23 | + |
| 24 | + |
| 25 | +## Write dummy code file to project |
| 26 | + |
| 27 | +example_code <- ' |
| 28 | +library(checkpoint) |
| 29 | +checkpoint("2015-04-26", checkpointLocation = tempdir()) |
| 30 | +
|
| 31 | +library(MASS) |
| 32 | +hist(islands) |
| 33 | +truehist(islands) |
| 34 | +' |
| 35 | + |
| 36 | +cat(example_code, file = file.path(example_project, "checkpoint_example_code.R")) |
| 37 | + |
| 38 | + |
| 39 | +## ----checkpoint---------------------------------------------------------- |
| 40 | +## Create a checkpoint by specifying a snapshot date |
| 41 | + |
| 42 | +library(checkpoint) |
| 43 | +dir.create(file.path(tempdir(), ".checkpoint")) |
| 44 | +checkpoint("2015-04-26", project = example_project, checkpointLocation = tempdir()) |
| 45 | + |
| 46 | +## ----inspect-1----------------------------------------------------------- |
| 47 | +getOption("repos") |
| 48 | + |
| 49 | +## ----inspect-2----------------------------------------------------------- |
| 50 | +normalizePath(.libPaths(), winslash = "/") |
| 51 | + |
| 52 | +## ----inspect-3----------------------------------------------------------- |
| 53 | +installed.packages()[, "Package"] |
| 54 | + |
| 55 | +## ----cleanup, include=FALSE---------------------------------------------- |
| 56 | +## cleanup |
| 57 | + |
| 58 | +unlink(example_project, recursive = TRUE) |
| 59 | +options(repos = oldRepos) |
| 60 | +.libPaths(oldLibPaths) |
| 61 | + |
0 commit comments