Skip to content

Commit 83c416a

Browse files
committed
Rebuild vignettes
1 parent de9967c commit 83c416a

File tree

6 files changed

+759
-0
lines changed

6 files changed

+759
-0
lines changed

vignettes/checkpoint.R

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
## ---- eval=FALSE---------------------------------------------------------
2+
# library(checkpoint)
3+
# checkpoint("2015-04-26", checkpointLocation = tempdir())
4+
5+
## ---- eval=FALSE, warning=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, showWarnings = FALSE)
20+
oldRepos <- getOption("repos")
21+
oldLibPaths <- .libPaths()
22+
23+
24+
## Write dummy code file to project
25+
26+
example_code <- '
27+
library(checkpoint)
28+
checkpoint("2015-04-26", checkpointLocation = tempdir())
29+
30+
library(MASS)
31+
hist(islands)
32+
truehist(islands)
33+
'
34+
35+
cat(example_code, file = file.path(example_project, "checkpoint_example_code.R"))
36+
37+
38+
## ----checkpoint, warning=FALSE-------------------------------------------
39+
## Create a checkpoint by specifying a snapshot date
40+
41+
library(checkpoint)
42+
dir.create(file.path(tempdir(), ".checkpoint"), recursive = TRUE)
43+
checkpoint("2015-04-26", project = example_project, checkpointLocation = tempdir())
44+
45+
## ----inspect-1-----------------------------------------------------------
46+
getOption("repos")
47+
48+
## ----inspect-2-----------------------------------------------------------
49+
normalizePath(.libPaths(), winslash = "/")
50+
51+
## ----inspect-3-----------------------------------------------------------
52+
installed.packages()[, "Package"]
53+
54+
## ----cleanup, include=FALSE----------------------------------------------
55+
## cleanup
56+
57+
unlink(example_project, recursive = TRUE)
58+
unlink(file.path(tempdir(), "checkpoint_example_code.R"))
59+
unlink(file.path(tempdir(), ".checkpoint"), recursive = TRUE)
60+
options(repos = oldRepos)
61+
unCheckpoint(oldLibPaths)
62+

vignettes/checkpoint.html

Lines changed: 207 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
## ---- eval=FALSE---------------------------------------------------------
2+
# library(MASS)
3+
# hist(islands)
4+
# truehist(islands)
5+
6+
## ----setup-1, include=FALSE----------------------------------------------
7+
## Write dummy code file to project
8+
example_code <- '
9+
library(MASS)
10+
library(chron)
11+
'
12+
dir.create(tempdir(), recursive = TRUE)
13+
cat(example_code, file = file.path(tempdir(), "managing_checkpoint_example_code.R"))
14+
15+
## ----checkpoint, results="hide", message=FALSE, warning=FALSE------------
16+
## Create a checkpoint by specifying a snapshot date
17+
library(checkpoint)
18+
dir.create(file.path(tempdir(), ".checkpoint"), recursive = TRUE, showWarnings = FALSE)
19+
checkpoint("2015-04-26", project = tempdir(), checkpointLocation = tempdir())
20+
21+
22+
## ----archives-1----------------------------------------------------------
23+
# List checkpoint archives on disk.
24+
checkpointArchives(tempdir())
25+
26+
## ----archives-2----------------------------------------------------------
27+
checkpointArchives(tempdir(), full.names = TRUE)
28+
29+
## ----access--------------------------------------------------------------
30+
# Returns the date the snapshot was last accessed.
31+
getAccessDate(tempdir())
32+
33+
34+
## ----remove-1, eval=FALSE------------------------------------------------
35+
# # Remove singe checkpoint archive from disk.
36+
# checkpointRemove("2015-04-26")
37+
38+
## ----remove-2, eval=FALSE------------------------------------------------
39+
# # Remove range of checkpoint archives from disk.
40+
# checkpointRemove("2015-04-26", allSinceSnapshot = TRUE)
41+
# checkpointRemove("2015-04-26", allUntilSnapshot = = TRUE)
42+
#
43+
44+
## ----remove-3, eval=FALSE------------------------------------------------
45+
# # Remove snapshot archives that have not been used recently
46+
# checkpointRemove("2015-04-26", notUsedSince = TRUE)
47+
#
48+
49+
## ----logfile-1-----------------------------------------------------------
50+
dir(file.path(tempdir(), ".checkpoint"))
51+
52+
## ----logfile-2-----------------------------------------------------------
53+
54+
log_file <- file.path(tempdir(), ".checkpoint", "checkpoint_log.csv")
55+
log <- read.csv(log_file)
56+
head(log)
57+
58+
## ----uncheckpoint-1------------------------------------------------------
59+
.libPaths()
60+
61+
## ----uncheckpoint-2------------------------------------------------------
62+
# Note this is still experimental
63+
unCheckpoint()
64+
.libPaths()
65+
66+
## ----cleanup, include=FALSE----------------------------------------------
67+
## cleanup
68+
unlink("manifest.R")
69+
unlink(file.path(tempdir(), "managing_checkpoint_example_code.R"))
70+
unlink(file.path(tempdir(), ".checkpoint"), recursive = TRUE)
71+

0 commit comments

Comments
 (0)