Skip to content

Commit 07f13c3

Browse files
committed
rebuild and rechek
1 parent 5ce313e commit 07f13c3

31 files changed

+192
-227
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Package: wrapr
22
Type: Package
33
Title: Wrap R Tools for Debugging and Parametric Programming
44
Version: 2.0.7
5-
Date: 2021-01-30
5+
Date: 2021-02-03
66
Authors@R: c(
77
person("John", "Mount", email = "[email protected]", role = c("aut", "cre")),
88
person("Nina", "Zumel", email = "[email protected]", role = c("aut")),

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
# wrapr 2.0.7 2021-01-30
2+
# wrapr 2.0.7 2021-02-03
33

44
* Add bc() blank-separated parsing, suggested by Emil Erik Pula Bellamy Begtrup-Bright \url{https://github.com/WinVector/wrapr/issues/12}.
55
* Fix strsplit_capture empty-return type.

README.md

Lines changed: 84 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -10,62 +10,55 @@ for writing and debugging `R` code.
1010

1111
![](https://github.com/WinVector/wrapr/raw/master/tools/wraprs.png)
1212

13-
## Introduction
13+
Introduction
14+
------------
1415

1516
Primary `wrapr` services include:
1617

17-
- [`%.>%`](https://winvector.github.io/wrapr/reference/dot_arrow.html)
18-
(dot arrow
19-
pipe)
20-
- [`unpack`](https://winvector.github.io/wrapr/reference/unpack.html)/[`to`](https://winvector.github.io/wrapr/reference/to.html)
21-
(assign to multiple
22-
values)
23-
- [`as_named_list`](https://winvector.github.io/wrapr/reference/as_named_list.html)
24-
(build up a named list
25-
quickly)
26-
- [`build_frame()`](https://winvector.github.io/wrapr/reference/build_frame.html)
18+
- [`%.>%`](https://winvector.github.io/wrapr/reference/dot_arrow.html)
19+
(dot arrow pipe)
20+
- [`unpack`](https://winvector.github.io/wrapr/reference/unpack.html)/[`to`](https://winvector.github.io/wrapr/reference/to.html)
21+
(assign to multiple values)
22+
- [`as_named_list`](https://winvector.github.io/wrapr/reference/as_named_list.html)
23+
(build up a named list quickly)
24+
- [`build_frame()`](https://winvector.github.io/wrapr/reference/build_frame.html)
2725
/
2826
[`draw_frame()`](https://winvector.github.io/wrapr/reference/draw_frame.html)
2927
( `data.frame` builders and formatters )
30-
- [`qc()`](https://winvector.github.io/wrapr/reference/qc.html)
31-
(quoting
32-
concatenate)
33-
- [`:=`](https://winvector.github.io/wrapr/reference/named_map_builder.html)
28+
- [`qc()`](https://winvector.github.io/wrapr/reference/qc.html)
29+
(quoting concatenate)
30+
- [`:=`](https://winvector.github.io/wrapr/reference/named_map_builder.html)
3431
(named map builder)
35-
- [`%?%`](https://winvector.github.io/wrapr/reference/coalesce.html)
32+
- [`%?%`](https://winvector.github.io/wrapr/reference/coalesce.html)
3633
(coalesce)
37-
- [`%.|%`](https://winvector.github.io/wrapr/reference/reduceexpand.html)
38-
(reduce/expand
39-
args)
40-
- [`uniques()`](https://winvector.github.io/wrapr/reference/uniques.html)
41-
(safe `unique()`
42-
replacement)
43-
- [`partition_tables()`](https://winvector.github.io/wrapr/reference/partition_tables.html)
34+
- [`%.|%`](https://winvector.github.io/wrapr/reference/reduceexpand.html)
35+
(reduce/expand args)
36+
- [`uniques()`](https://winvector.github.io/wrapr/reference/uniques.html)
37+
(safe `unique()` replacement)
38+
- [`partition_tables()`](https://winvector.github.io/wrapr/reference/partition_tables.html)
4439
/
4540
[`execute_parallel()`](https://winvector.github.io/wrapr/reference/execute_parallel.html)
46-
- [`DebugFnW()`](https://winvector.github.io/wrapr/reference/DebugFnW.html)
47-
(function debug
48-
wrappers)
49-
- [`λ()`](https://winvector.github.io/wrapr/reference/defineLambda.html)
41+
- [`DebugFnW()`](https://winvector.github.io/wrapr/reference/DebugFnW.html)
42+
(function debug wrappers)
43+
- [`λ()`](https://winvector.github.io/wrapr/reference/defineLambda.html)
5044
(anonymous function builder)
51-
- [`let()`](https://winvector.github.io/wrapr/reference/let.html) (let
45+
- [`let()`](https://winvector.github.io/wrapr/reference/let.html) (let
5246
block)
53-
- [`evalb()`/`si()`](https://winvector.github.io/wrapr/articles/bquote.html)
47+
- [`evalb()`/`si()`](https://winvector.github.io/wrapr/articles/bquote.html)
5448
(evaluate with `bquote` / string interpolation)
55-
- [`sortv()`](https://winvector.github.io/wrapr/reference/sortv.html)
49+
- [`sortv()`](https://winvector.github.io/wrapr/reference/sortv.html)
5650
(sort a data.frame by a set of columns).
5751

58-
<!-- end list -->
59-
6052
``` r
6153
library(wrapr)
6254
packageVersion("wrapr")
63-
# [1] '2.0.2'
55+
# [1] '2.0.7'
6456
date()
65-
# [1] "Mon Aug 10 15:24:46 2020"
57+
# [1] "Wed Feb 3 07:32:56 2021"
6658
```
6759

68-
## [`%.>%` (dot pipe or dot arrow)](https://winvector.github.io/wrapr/articles/dot_pipe.html)
60+
[`%.>%` (dot pipe or dot arrow)](https://winvector.github.io/wrapr/articles/dot_pipe.html)
61+
------------------------------------------------------------------------------------------
6962

7063
`%.>%` dot arrow pipe is a pipe with intended semantics:
7164

@@ -127,76 +120,50 @@ for more details. Some formal documentation can be found
127120
[here](https://github.com/WinVector/wrapr/blob/master/extras/wrapr_pipe.pdf).
128121

129122
<ul>
130-
131123
<li>
132-
133124
Some obvious “dot-free”" right-hand sides are rejected. Pipelines are
134125
meant to move values through a sequence of transforms, and not just for
135126
side-effects. Example: `5 %.>% 6` deliberately stops as `6` is a
136127
right-hand side that obviously does not use its incoming value. This
137128
check is only applied to values, not functions on the right-hand side.
138-
139129
</li>
140-
141130
<li>
142-
143131
Trying to pipe into a an “zero argument function evaluation expression”
144132
such as `sin()` is prohibited as it looks too much like the user
145133
declaring `sin()` takes no arguments. One must pipe into either a
146134
function, function name, or an non-trivial expression (such as
147-
`sin(.)`). A useful error message is returned to the user: `wrapr::pipe
148-
does not allow direct piping into a no-argument function call expression
149-
(such as "sin()" please use sin(.))`.
150-
135+
`sin(.)`). A useful error message is returned to the user:
136+
`wrapr::pipe does not allow direct piping into a no-argument function call expression (such as "sin()" please use sin(.))`.
151137
</li>
152-
153138
<li>
154-
155-
Some reserved words can not be piped into. One example is `5 %.>%
156-
return(.)` is prohibited as the obvious pipe implementation would not
157-
actually escape from user functions as users may intend.
158-
139+
Some reserved words can not be piped into. One example is
140+
`5 %.>% return(.)` is prohibited as the obvious pipe implementation
141+
would not actually escape from user functions as users may intend.
159142
</li>
160-
161143
<li>
162-
163144
Obvious de-references (such as `$`, `::`, `@`, and a few more) on the
164145
right-hand side are treated performed (example: `5 %.>% base::sin(.)`).
165-
166146
</li>
167-
168147
<li>
169-
170-
Outer parenthesis on the right-hand side are removed (example: `5 %.>%
171-
(sin(.))`).
172-
148+
Outer parenthesis on the right-hand side are removed (example:
149+
`5 %.>% (sin(.))`).
173150
</li>
174-
175151
<li>
176-
177152
Anonymous function constructions are evaluated so the function can be
178-
applied (example: `5 %.>% function(x) {x+1}` returns 6, just as `5 %.>%
179-
(function(x) {x+1})(.)` does).
180-
153+
applied (example: `5 %.>% function(x) {x+1}` returns 6, just as
154+
`5 %.>% (function(x) {x+1})(.)` does).
181155
</li>
182-
183156
<li>
184-
185157
Checks and transforms are not performed on items inside braces (example:
186158
`5 %.>% { function(x) {x+1} }` returns `function(x) {x+1}`, not 6).
187-
188159
</li>
189-
190160
<li>
191-
192161
The dot arrow pipe has S3/S4 dispatch (please see ). However as the
193162
right-hand side of the pipe is normally held unevaluated, we don’t know
194163
the type except in special cases (such as the rigth-hand side being
195164
referred to by a name or variable). To force the evaluation of a pipe
196165
term, simply wrap it in `.()`.
197-
198166
</li>
199-
200167
</ul>
201168

202169
The dot pipe is also user configurable through standard `S3`/`S4`
@@ -213,7 +180,8 @@ Journal](https://journal.r-project.org/archive/2018/RJ-2018-042/index.html).
213180
url = {https://journal.r-project.org/archive/2018/RJ-2018-042/index.html}
214181
}
215182

216-
## [`unpack`](https://winvector.github.io/wrapr/reference/unpack.html)/[`to`](https://winvector.github.io/wrapr/reference/to.html) multiple assignments
183+
[`unpack`](https://winvector.github.io/wrapr/reference/unpack.html)/[`to`](https://winvector.github.io/wrapr/reference/to.html) multiple assignments
184+
----------------------------------------------------------------------------------------------------------------------------------------------------
217185

218186
Unpack a named list into the current environment by name (for a
219187
positional based multiple assignment operator please see
@@ -236,13 +204,14 @@ unpack[
236204
knitr::kable(train_data)
237205
```
238206

239-
| | x | group |
240-
| - | -: | :---- |
241-
| 1 | 1 | train |
242-
| 4 | 4 | train |
243-
| 7 | 7 | train |
207+
| | x | group |
208+
|:----|----:|:------|
209+
| 1 | 1 | train |
210+
| 4 | 4 | train |
211+
| 7 | 7 | train |
244212

245-
## [`as_named_list`](https://winvector.github.io/wrapr/reference/as_named_list.html)
213+
[`as_named_list`](https://winvector.github.io/wrapr/reference/as_named_list.html)
214+
---------------------------------------------------------------------------------
246215

247216
Build up named lists. [Very convenient for managing workspaces when used
248217
with used with
@@ -269,7 +238,8 @@ as_named_list(train_data, calibrate_data, test_data)
269238
# 9 9 test
270239
```
271240

272-
## [`build_frame()`](https://winvector.github.io/wrapr/reference/build_frame.html) / [`draw_frame()`](https://winvector.github.io/wrapr/reference/draw_frame.html)
241+
[`build_frame()`](https://winvector.github.io/wrapr/reference/build_frame.html) / [`draw_frame()`](https://winvector.github.io/wrapr/reference/draw_frame.html)
242+
---------------------------------------------------------------------------------------------------------------------------------------------------------------
273243

274244
[`build_frame()`](https://winvector.github.io/wrapr/reference/build_frame.html)
275245
is a convenient way to type in a small example `data.frame` in natural
@@ -300,7 +270,8 @@ cat(draw_frame(x))
300270
# "accuracy" , 0.8 , 0.6 )
301271
```
302272

303-
## [`qc()` (quoting concatenate)](https://winvector.github.io/wrapr/reference/qc.html)
273+
[`qc()` (quoting concatenate)](https://winvector.github.io/wrapr/reference/qc.html)
274+
-----------------------------------------------------------------------------------
304275

305276
`qc()` is a quoting variation on `R`’s concatenate operator `c()`. This
306277
code such as the following:
@@ -325,10 +296,10 @@ qc(.(aname) := x, b = .(yvalue))
325296
# "x" "six"
326297
```
327298

328-
Notice the `:=` notation is required for syntacitic
329-
reasons.
299+
Notice the `:=` notation is required for syntacitic reasons.
330300

331-
## [`:=` (named map builder)](https://winvector.github.io/seplyr/articles/named_map_builder.html)
301+
[`:=` (named map builder)](https://winvector.github.io/seplyr/articles/named_map_builder.html)
302+
----------------------------------------------------------------------------------------------
332303

333304
`:=` is the “named map builder”. It allows code such as the following:
334305

@@ -365,7 +336,8 @@ c('a' := 'x', 'b' := 'y')
365336
The named map builder is [designed to synergize with
366337
`seplyr`](https://winvector.github.io/seplyr/articles/named_map_builder.html).
367338

368-
## [`%?%` (coalesce)](https://winvector.github.io/wrapr/reference/coalesce.html)
339+
[`%?%` (coalesce)](https://winvector.github.io/wrapr/reference/coalesce.html)
340+
-----------------------------------------------------------------------------
369341

370342
The coalesce operator tries to replace elements of its first argument
371343
with elements from its second argument. In particular `%?%` replaces
@@ -378,13 +350,14 @@ c(1, NA) %?% list(NA, 20)
378350
# [1] 1 20
379351
```
380352

381-
## [`%.|%` (reduce/expand args)](https://winvector.github.io/wrapr/reference/reduceexpand.html)
353+
[`%.|%` (reduce/expand args)](https://winvector.github.io/wrapr/reference/reduceexpand.html)
354+
--------------------------------------------------------------------------------------------
382355

383-
`x %.|% f` stands for `f(x[[1]], x[[2]], ..., x[[length(x)]])`. `v %|.%
384-
x` also stands for `f(x[[1]], x[[2]], ..., x[[length(x)]])`. The two
385-
operators are the same, the variation just allowing the user to choose
386-
the order they write things. The mnemonic is: “data goes on the dot-side
387-
of the operator.”
356+
`x %.|% f` stands for `f(x[[1]], x[[2]], ..., x[[length(x)]])`.
357+
`v %|.% x` also stands for `f(x[[1]], x[[2]], ..., x[[length(x)]])`. The
358+
two operators are the same, the variation just allowing the user to
359+
choose the order they write things. The mnemonic is: “data goes on the
360+
dot-side of the operator.”
388361

389362
``` r
390363
args <- list('prefix_', c(1:3), '_suffix')
@@ -398,18 +371,19 @@ paste0 %|.% args
398371
# prefix_1_suffix" "prefix_2_suffix" "prefix_3_suffix"
399372
```
400373

401-
## [`DebugFnW()`](https://winvector.github.io/wrapr/articles/DebugFnW.html)
374+
[`DebugFnW()`](https://winvector.github.io/wrapr/articles/DebugFnW.html)
375+
------------------------------------------------------------------------
402376

403377
`DebugFnW()` wraps a function for debugging. If the function throws an
404378
exception the execution context (function arguments, function name, and
405379
more) is captured and stored for the user. The function call can then be
406380
reconstituted, inspected and even re-run with a step-debugger. Please
407381
see our [free debugging video
408382
series](https://youtu.be/-P9UzQuJSH8?list=PLAKBwakacHbQT51nPHex1on3YNCCmggZA)
409-
and `vignette('DebugFnW', package='wrapr')` for
410-
examples.
383+
and `vignette('DebugFnW', package='wrapr')` for examples.
411384

412-
## [`λ()` (anonymous function builder)](https://winvector.github.io/wrapr/articles/lambda.html)
385+
[`λ()` (anonymous function builder)](https://winvector.github.io/wrapr/articles/lambda.html)
386+
--------------------------------------------------------------------------------------------
413387

414388
`λ()` is a concise abstract function creator or “[lambda
415389
abstraction](https://en.wikipedia.org/wiki/Lambda_calculus)”. It is a
@@ -427,7 +401,8 @@ sapply(1:4, λ(x, x^2))
427401
# [1] 1 4 9 16
428402
```
429403

430-
## [`let()`](https://winvector.github.io/wrapr/articles/let.html)
404+
[`let()`](https://winvector.github.io/wrapr/articles/let.html)
405+
--------------------------------------------------------------
431406

432407
`let()` allows execution of arbitrary code with substituted variable
433408
names (note this is subtly different than binding values for names as
@@ -492,10 +467,10 @@ formal documentation can be found
492467
`wrapr::let()` was inspired by `gtools::strmacro()` and
493468
`base::bquote()`, please see
494469
[here](https://github.com/WinVector/wrapr/blob/master/extras/bquote.md)
495-
for some notes on macro methods in
496-
`R`.
470+
for some notes on macro methods in `R`.
497471

498-
# [`evalb()`/`si()`](https://winvector.github.io/wrapr/articles/bquote.html) (evaluate with `bquote` / string interpolation)
472+
[`evalb()`/`si()`](https://winvector.github.io/wrapr/articles/bquote.html) (evaluate with `bquote` / string interpolation)
473+
==========================================================================================================================
499474

500475
`wrapr` supplies unified notation for quasi-quotation and string
501476
interpolation.
@@ -513,16 +488,15 @@ evalb(
513488
![](tools/README-unnamed-chunk-3-1.png)<!-- -->
514489

515490
``` r
516-
517491
# alter string
518492
si("plot(x = .(variable), y = .(variable))")
519493
# [1] "plot(x = \"angle\", y = \"angle\")"
520494
```
521495

522-
The extra `.(-x)` form is a shortcut for
523-
`.(as.name(x))`.
496+
The extra `.(-x)` form is a shortcut for `.(as.name(x))`.
524497

525-
# [`sortv()`](https://winvector.github.io/wrapr/reference/sortv.html) (sort a data.frame by a set of columns)
498+
[`sortv()`](https://winvector.github.io/wrapr/reference/sortv.html) (sort a data.frame by a set of columns)
499+
===========================================================================================================
526500

527501
This is the sort command that is missing from `R`: sort a `data.frame`
528502
by a chosen set of columns specified in a variable.
@@ -544,25 +518,27 @@ sortv(d, order_cols)
544518
# 3 3 4 3
545519
```
546520

547-
## Installation
521+
Installation
522+
------------
548523

549524
Install with:
550525

551526
``` r
552527
install.packages("wrapr")
553528
```
554529

555-
## More Information
530+
More Information
531+
----------------
556532

557533
More details on `wrapr` capabilities can be found in the following two
558-
technical
559-
articles:
534+
technical articles:
560535

561-
- [let](https://github.com/WinVector/wrapr/blob/master/extras/wrapr_let.pdf)
562-
- [R Journal “Dot-Pipe: an S3 Extensible Pipe for
536+
- [let](https://github.com/WinVector/wrapr/blob/master/extras/wrapr_let.pdf)
537+
- [R Journal “Dot-Pipe: an S3 Extensible Pipe for
563538
R”"](https://journal.r-project.org/archive/2018/RJ-2018-042/index.html)
564539

565-
## Note
540+
Note
541+
----
566542

567543
Note: `wrapr` is meant only for “tame names”, that is: variables and
568544
column names that are also valid *simple* (without quotes) `R` variables

0 commit comments

Comments
 (0)