Closed homerhanumat closed 6 years ago
I've reworked how snippet()
finds things. It now uses partial string matching against an internal list of chunk names as is aware of sequences of snippets. When there are multiple matches, they are listed to help the user refine the request.
library(fastR2)
# Multiple partial matches are displayed
snippet("bin", execute = FALSE, view = FALSE)
#> Multiple matches found for `bin':
#> binom, binom-bayes, binom-cis, binom-grid, binom-lci, binom-odds-ci, binom-wald-ci, binomial-ztest
# Exact match is used
snippet("binom", execute = FALSE, view = FALSE)
#>
#> ## snippet: binom
# snippet() is aware of sequential numbering
snippet("binom-b", execute = FALSE, view = FALSE)
#>
#> ## snippet: binom-bayes01
#>
#> ## snippet: binom-bayes02
# To get one chunk from a sequence, use the full name
snippet("binom-bayes01", execute = FALSE, view = FALSE)
#>
#> ## snippet: binom-bayes01
Created on 2018-08-14 by the reprex package (v0.2.0).
snippet("binom")
runs several snippets containing the string"binom"
, eventually throwing an error atbinom-grid.R
, but never runsbinom.R
.Current workaround is
snippet("^binom\\.R$")
.