Skip to content

Commit 22fcce8

Browse files
committed
make vignette static
1 parent f7349c8 commit 22fcce8

1 file changed

Lines changed: 29 additions & 56 deletions

File tree

vignettes/checkpoint.Rmd

Lines changed: 29 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ To create a checkpoint project, you do:
8383

8484
```r
8585
library(checkpoint)
86-
checkpoint("2015-04-26", checkpointLocation = tempdir())
86+
checkpoint("<checkpoint date>", checkpointLocation = tempdir())
8787
```
8888

8989
4. Run the script.
@@ -94,7 +94,7 @@ For example, your script may look like this:
9494

9595
```r
9696
library(checkpoint)
97-
checkpoint("2015-04-26", checkpointLocation = tempdir())
97+
checkpoint("2017-04-01")
9898

9999
# Example from ?darts
100100
library(darts)
@@ -116,45 +116,7 @@ par(oldpar)
116116

117117
Next you want to run the script. Here is what `checkpoint` does:
118118

119-
120-
```{r setup, include=FALSE, fig.asp=4/3}
121-
122-
## Create temporary project and set working directory
123-
124-
125-
example_project <- tempfile(pattern="proj")
126-
127-
dir.create(example_project, recursive = TRUE, showWarnings = FALSE)
128-
oldRepos <- getOption("repos")
129-
oldLibPaths <- .libPaths()
130-
131-
132-
## Write dummy code file to project
133-
134-
example_code <- '
135-
library(checkpoint)
136-
checkpoint("2015-04-26", checkpointLocation = tempdir())
137-
138-
# Example from ?darts
139-
library(darts)
140-
x = c(12,16,19,3,17,1,25,19,17,50,18,1,3,17,2,2,13,18,16,2,25,5,5,
141-
1,5,4,17,25,25,50,3,7,17,17,3,3,3,7,11,10,25,1,19,15,4,1,5,12,17,16,
142-
50,20,20,20,25,50,2,17,3,20,20,20,5,1,18,15,2,3,25,12,9,3,3,19,16,20,
143-
5,5,1,4,15,16,5,20,16,2,25,6,12,25,11,25,7,2,5,19,17,17,2,12)
144-
mod = simpleEM(x, niter=100)
145-
e = simpleExpScores(mod$s.final)
146-
oldpar <- par(mfrow=c(1, 2))
147-
drawHeatmap(e)
148-
drawBoard(new=TRUE)
149-
drawAimSpot(e, cex = 5)
150-
par(oldpar)
151-
'
152-
153-
cat(example_code, file = file.path(example_project, "checkpoint_example_code.R"))
154-
155-
```
156-
157-
```{r checkpoint, warning=FALSE}
119+
```r
158120
## Create a folder to contain the checkpoint
159121
## This is optional - the default is to use ~/.checkpoint
160122

@@ -167,36 +129,47 @@ checkpoint("2017-04-01", project = example_project,
167129
checkpointLocation = tempdir())
168130
```
169131

132+
```
133+
## Scanning for packages used in this project
134+
## - Discovered 2 packages
135+
## Installing packages used in this project
136+
## - Installing 'darts'
137+
## darts
138+
## Package which is only available in source form, and may need
139+
## compilation of C/C++/Fortran: 'darts'
140+
## installing the source package 'darts'
141+
## checkpoint process complete
142+
## ---
143+
```
144+
170145
### Inspecting the results
171146

172147
Now inspect the results. First, check that your CRAN mirror is set to MRAN snapshot:
173148

174149

175-
```{r inspect-1}
150+
```r
176151
getOption("repos")
177152
```
178-
153+
```
154+
## [1] "https://mran.microsoft.com/snapshot/2017-04-01"
155+
```
179156

180157
Next, check that the library path is set to `~/.checkpoint`:
181158

182-
```{r inspect-2}
159+
```r
183160
normalizePath(.libPaths(), winslash = "/")
184161
```
162+
```
163+
## [1] "C:/Users/hongo/AppData/Local/Temp/RtmpEPckx0/.checkpoint/2017-04-01/lib/x86_64-w64-mingw32/3.6.1"
164+
## [2] "C:/Users/hongo/AppData/Local/Temp/RtmpEPckx0/.checkpoint/R-3.6.1"
165+
## [3] "C:/Program Files/R/R-3.6.1/library"
166+
```
185167

186168
Finally, check which packages are installed in checkpoint library:
187169

188-
```{r inspect-3, eval=FALSE}
170+
```r
189171
installed.packages(.libPaths()[1])[, "Package"]
190172
```
191-
192-
193-
```{r cleanup, include=TRUE}
194-
## cleanup
195-
196-
unlink(example_project, recursive = TRUE)
197-
unlink(file.path(example_project, "checkpoint_example_code.R"))
198-
unlink(file.path(tempdir(), ".checkpoint"), recursive = TRUE)
199-
options(repos = oldRepos)
200-
unCheckpoint(oldLibPaths)
201-
.libPaths()
173+
```
174+
## [1] "darts"
202175
```

0 commit comments

Comments
 (0)