Title: | Brace Expansions |
---|---|
Description: | Performs brace expansions on strings. Made popular by Unix shells, brace expansion allows users to concisely generate certain character vectors by taking a single string and (recursively) expanding the comma-separated lists and double-period-separated integer and character sequences enclosed within braces in that string. The double-period-separated numeric integer expansion also supports padding the resulting numbers with zeros. |
Authors: | Trevor L Davis [aut, cre] , Jon Schlinkert [aut] (Author of the 'braces' Javascript library) |
Maintainer: | Trevor L Davis <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.2.3-0 |
Built: | 2024-11-10 05:30:30 UTC |
Source: | https://github.com/trevorld/bracer |
expand_braces()
performs brace expansions on strings.
str_expand_braces()
is an alternate that returns a list of character vectors.
Made popular by Unix shells, brace expansion allows users to concisely generate
certain character vectors by taking a single string and (recursively) expanding
the comma-separated lists and double-period-separated integer and character
sequences enclosed within braces in that string.
The double-period-separated numeric integer expansion also supports padding the resulting numbers with zeros.
expand_braces(string, engine = getOption("bracer.engine", NULL)) str_expand_braces(string, engine = getOption("bracer.engine", NULL))
expand_braces(string, engine = getOption("bracer.engine", NULL)) str_expand_braces(string, engine = getOption("bracer.engine", NULL))
string |
input character vector |
engine |
If |
expand_braces()
returns a character vector while
str_expand_braces()
returns a list of character vectors.
expand_braces("Foo{A..F}", engine = "r") expand_braces("Foo{01..10}", engine = "r") expand_braces("Foo{A..E..2}{1..5..2}", engine = "r") expand_braces("Foo{-01..1}", engine = "r") expand_braces("Foo{{d..d},{bar,biz}}.{py,bash}", engine = "r") expand_braces(c("Foo{A..F}", "Bar.{py,bash}", "{{Biz}}"), engine = "r") str_expand_braces(c("Foo{A..F}", "Bar.{py,bash}", "{{Biz}}"), engine = "r")
expand_braces("Foo{A..F}", engine = "r") expand_braces("Foo{01..10}", engine = "r") expand_braces("Foo{A..E..2}{1..5..2}", engine = "r") expand_braces("Foo{-01..1}", engine = "r") expand_braces("Foo{{d..d},{bar,biz}}.{py,bash}", engine = "r") expand_braces(c("Foo{A..F}", "Bar.{py,bash}", "{{Biz}}"), engine = "r") str_expand_braces(c("Foo{A..F}", "Bar.{py,bash}", "{{Biz}}"), engine = "r")
glob()
is a wrapper around Sys.glob()
that uses
expand_braces()
to support both brace and wildcard
expansion on file paths.
glob(paths, ..., engine = getOption("bracer.engine", NULL))
glob(paths, ..., engine = getOption("bracer.engine", NULL))
paths |
character vector of patterns for relative or absolute filepaths. |
... |
Passed to |
engine |
If |
dir <- system.file("R", package="bracer") path <- file.path(dir, "*.{R,r,S,s}") glob(path, engine = "r")
dir <- system.file("R", package="bracer") path <- file.path(dir, "*.{R,r,S,s}") glob(path, engine = "r")