https://github.com/dgkf/rec
Record your R session and play it back
https://github.com/dgkf/rec
Last synced: 8 months ago
JSON representation
Record your R session and play it back
- Host: GitHub
- URL: https://github.com/dgkf/rec
- Owner: dgkf
- Created: 2021-11-02T14:34:54.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-08-09T13:20:08.000Z (over 2 years ago)
- Last Synced: 2025-03-27T15:06:30.394Z (9 months ago)
- Language: R
- Size: 11.7 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- jimsghstars - dgkf/rec - Record your R session and play it back (R)
README
# :red_circle: rec
Record and play back your R
> :warning: the features here are almost entirely covered by
> [asciicast](https://github.com/r-lib/asciicast), a more mature
> and better maintained project :warning:
`rec` captures code evaluation and output, trying to preserve the R objects,
console output and conditions (messages, warnings and errors) emitted during
evaluation.
## Quick Start
`rec` operates in one of two ways, either recording an expression's evaluation,
or recording the top level interactive console. In both, cases, you can use
the singular interface, `rec()`. Once you've recorded evaluation, you
can also play it back!
[](https://asciinema.org/a/MvqJkDVvH4gTBz618RCU58l0m)
### Record your console
Recording your console is started and stopped by running `rec()`. While
recording, you'll see a ":red_circle:" in front of your command prompt,
indicating that you're in a recording session.
```r
rec()
print(1:3)
# [1] 1 2 3
rec() # stop recording
play()
# print(1:3)
# [1] 1 2 3
```
### Record expression evaluation
Alternatively, you may want to capture evaluation in the background. This can be
A helpful alternative to `capture.output`, for situations where you want to
capture messages, but want to restructure the formatting or operate
```r
recording <- rec(print(1:3))
# [1] 1 2 3
play(recording)
# print(1:3)
# [1] 1 2 3
```