-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
README.Rmd
124 lines (93 loc) · 4.03 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
# errorist
<!-- badges: start -->
[![R-CMD-check](https://github.com/coatless-rpkg/errorist/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/coatless-rpkg/errorist/actions/workflows/R-CMD-check.yaml)
[![CRAN\_Status\_Badge](https://www.r-pkg.org/badges/version/errorist)](https://cran.r-project.org/package=errorist)
[![CRAN RStudio mirror downloads](https://cranlogs.r-pkg.org/badges/errorist)](https://www.r-pkg.org/pkg/errorist)
<!-- badges: end -->
>
> _errorist_: one who holds to and propagates error
>
> --- [Merriam Webster](https://www.merriam-webster.com/dictionary/errorist)
The goal of `errorist` is to automatically search errors and warnings the
second they arise.
![](https://media.giphy.com/media/l1IBjB9qJ2jOnntOU/giphy.gif)
## Installation
The `errorist` package is available on both CRAN and GitHub. The CRAN
version is considered stable while the GitHub version is in a state of
development and may break. You can install the stable version of the
`errorist` package with:
```r
install.packages("errorist")
```
For the development version, you can opt for:
```r
if(!requireNamespace("remotes")) { install.packages("remotes") }
remotes::install_github("coatless-rpkg/errorist")
```
## Usage
```r
library(errorist)
```
## Details
When the `errorist` package is loaded, two handlers are automatically
established to intercept the error and warning messages that arise during
execution of code. The intercepted messages are then directed to pre-specified
search engines on the internet using the user's preferred system web browser.
By default, the search engine used to look up the messages is Google.
You can specify a different search engine handler by setting default values:
- `errorist.warning`: Warning search engine portal. The default is `searcher::search_google`.
- `errorist.error`: Error search engine portal. The default is `searcher::search_google`.
- `errorist.autoload`: Automatically search errors. The default is `TRUE`.
If frequent use of the package occurs, consider adding the different search
handlers as an option in your `.Rprofile`:
```r
# Add custom options
.First <- function() {
options(
errorist.warning = searcher::search_google,
errorist.error = searcher::search_google
)
}
# Load the package if in RStudio or R GUI
if (interactive()) {
suppressMessages(require(errorist))
}
```
# Motivation
The idea for `errorist` came from a conversation among
[Dirk Eddelbuettel](http://dirk.eddelbuettel.com),
[Barry Rowlingson](http://barry.rowlingson.com), and myself musing about
having compilers provide a link explaining what the error meant and how to
solve it. This conversation was sprouted due to the mouse overtext of
[XKCD Comic 1185: Ineffective Sorts](https://xkcd.com/1185/).
> StackSort connects to StackOverflow, searches for 'sort a list', and downloads
> and runs code snippets until the list is sorted.
This type of code search was implemented by:
<https://gkoberger.github.io/stacksort/>
The idea morphed from evaluating random code chunks to providing search support
for errors that occurred at runtime.
# Special Thanks
- [Dirk Eddelbuettel](http://dirk.eddelbuettel.com) for starting the discussion
on [XKCD Comic 1185: Ineffective Sorts](https://xkcd.com/1185/).
- [Barry Rowlingson](http://barry.rowlingson.com) for the package name and
remarks about functionality.
- [Brodie Gaslam](https://www.brodieg.com/) for pointing out
[`addTaskCallback()`](https://stat.ethz.ch/R-manual/R-devel/library/base/html/taskCallback.html)
as a way to create a warning handler and for a brief discussion on "call"
objects.
- [Joshua Ulrich](https://github.com/joshuaulrich/) for advise on incorporating
the semi-documented [`last.warning`](https://stat.ethz.ch/R-manual/R-devel/library/base/html/warning.html)
object that _R_ populates with warning messages.
# License
GPL (>= 2)