-
Notifications
You must be signed in to change notification settings - Fork 49
/
README.Rmd
426 lines (308 loc) · 9.04 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
---
output:
md_document
---
cowsay
======
```{r echo=FALSE}
knitr::opts_chunk$set(
comment = "#>",
collapse = TRUE
)
```
![cran checks](https://badges.cranchecks.info/worst/cowsay.svg)
[![R-check](https://github.com/sckott/cowsay/workflows/R-check/badge.svg)](https://github.com/sckott/cowsay/actions?query=workflow%3AR-check)
[![codecov](https://codecov.io/gh/sckott/cowsay/graph/badge.svg?token=fewxwGHXfv)](https://codecov.io/gh/sckott/cowsay)
[![rstudio mirror downloads](https://cranlogs.r-pkg.org/badges/cowsay)](https://github.com/r-hub/cranlogs.app)
[![cran version](https://www.r-pkg.org/badges/version/cowsay)](https://cran.r-project.org/package=cowsay)
### What is this?
If you are familiar with `cowsay` on the cli, then you know what this is, but for R. If not, read below. Why? Why not?
### Contributors (alphabetical)
```{r echo=FALSE}
peeps <- c(
"Scott Chamberlain",
"Tyler Rinker",
"Thomas Leeper",
"Noam Ross",
"Rich FitzJohn",
"Kiyoko Gotanda",
"Carson Sievert",
"Andy Teucher",
"Karl Broman",
"Franz-Sebastian Krah",
"Lucy D'Agostino McGowan",
"Guangchuang Yu",
"Paolo Sonego",
"Philipp Boersch-Supan",
"Andreas Brandmaier",
"Amanda Dobbyn",
"Marion Louveaux",
"David Schoch"
)
```
```{r results='asis', echo=FALSE}
cat(c("", sort(peeps)), sep = "\n * ")
```
That's right, it takes `r length(peeps)` people to make `cowsay` - it's that hard.
### Contributing
See [CONTRIBUTING.md][contrib]
### Where to find ASCII animal art
Sources to look in:
* https://asciiart.website/ - again, this person only collects them - no mention of license, permissions, etc.
Permissions
In the ascii art mailing list https://groups.google.com/forum/#!forum/alt.ascii-art they say:
```
As for posting other people's ASCII art,
after a discussion in news:alt.ascii-art _ ___
the following rules were agreed upon: #_~`--'__ `===-,
1. If an ASCII ART picture has initials `.`. `#.,//
on it, leave them on when posting it ,_\_\ ## #\
2. If an ASCII ART picture doesn't have `__.__ `####\
initials on it, mention that you ~~\ ,###'~
didn't draw it when posting it. \##'
3. If somebody posts a picture without [nosig]
initials and you have an original copy
with initials on, feel free to re-post the original version.
* The re-post ought not to be taken personally, as we all
know that ASCII art often loses proper credits.
Responses to the re-post are not necessary.
One contributor, name of Krogg, suggested the following:
1.) Ultra polite:...ya make yer own ascii and use it.
2.) Very polite:...Ya contact the author and ask if ya
can use it...
3.) polite:...Ya use it but you keep the Credits
in there like they should be.
4.) rude:...Ya use it and strip credits.
5.) Very rude:...Ya use it and claim that it Is
_Your_ very own creation...
```
So, let's go with this rule: Let's include found (on the web) ascii art in this pkg, include signature if there, and if no signature, put in a `[nosig]` (see above).
### Quick watch start
Asciicast: <https://asciinema.org/a/7745>
### Install
From CRAN
```{r eval=FALSE}
install.packages("cowsay")
```
Dev version
```{r eval=FALSE}
remotes::install_github("sckott/cowsay")
```
```{r}
library("cowsay")
```
### The animals
```{r}
sort(names(animals))
```
### Say Something
```{r}
say('time')
```
```{r}
say("ain't that some shit", "chicken")
```
Add some color:
```{r}
library(crayon)
```
```{r eval=FALSE}
say("boo!", "ghost",
what_color = "cyan", by_color = "saddlebrown")
```
<p align="left">
<img src="./man/img/ghost.jpg" alt="ghost" height="200px">
</p>
```{r eval=FALSE}
say("I love hooo you are!", "owl",
what_color = rgb(0, 1, 1), by_color = "#FF0000")
```
<p align="left">
<img src="./man/img/owl.jpg" alt="owl" height="200px">
</p>
String styles together [crayon-style](https://github.com/r-lib/crayon#styles):
```{r eval=FALSE}
say(what = "rms", by = "rms",
what_color = yellow$bgMagenta$bold,
by_color = cyan$italic)
```
<p align="left">
<img src="./man/img/rms.jpg" alt="rms" height="350px">
</p>
This doesn't preclude you from adding extra crayon colors to your `what` string directly.
```{r eval=FALSE}
say(what = paste0("hello ", crayon::yellow("there "), crayon::underline("world")),
by = "trilobite",
what_color = bgBlue$cyan$italic,
by_color = "thistle") # Don't ask me why "thistle" is pink/purple
```
<p align="left">
<img src="./man/img/trilobite.jpg" alt="trilobite" height="250px">
</p>
<!-- Multiple colors are also possible (uses the [`multicolor`](https://github.com/aedobbyn/multicolor) package):
```{r eval=FALSE}
say(what = "I'm a rare Irish buffalo",
by = "buffalo",
what_color = c("salmon2", "darkcyan", "salmon2", "darkcyan"),
by_color = c("green", "white", "orange"))
```
<p align="left">
<img src="./man/img/irish_buffalo.jpg" alt="irish_buffalo" height="350px">
</p>
-->
### Vary type of output, default calls message()
```{r}
say("hell no!")
```
```{r}
say("hell no!", type="warning")
```
```{r}
say("hell no!", type="string")
```
### Catfacts!!!!
From the catfacts API at <https://catfact.ninja>
```{r eval=FALSE}
say("catfact", "cat")
#> --------------
#> When a domestic cat goes after mice, about 1 pounce in 3 results in a catch.
#> --------------
#> \
#> \
#> \
#> |\___/|
#> ==) ^Y^ (==
#> \ ^ /
#> )=*=(
#> / \
#> | |
#> /| | | |\
#> \| | |_|/\
#> jgs //_// ___/
#> \_)
```
### Long cat
From the a Boing Boing tweet on 2014-05-10 "twitter.com/BoingBoing/status/465170473194512384" (post may be gone)
```{r}
say("it's caturday", "longcat")
```
### Grumpy cat
```{r}
say('NO!', by='grumpycat')
```
```{r}
say('WOKE UP TODAY, IT WAS TERRIBLE', by='grumpycat')
```
```{r}
say('I HAD FUN ONCE, IT WAS AWFUL', by='grumpycat')
```
### Bunny Holding a sign
```{r}
say(by='signbunny')
```
### Fish
```{r}
say(by='fish')
```
### R fortunes
```{r}
say('fortune','cat')
```
You can also pick a particular fortune by number or regex search - if the `fortune` parameter is not `NULL` you don't have pass anything to the `what` parameter (the 1st parameter)
```{r}
say(fortune=100)
```
```{r}
say(fortune='whatever')
```
### Trilobite
```{r}
say("Hi there :)", by='trilobite')
```
### Shark
```{r}
say('Q: What do you call a solitary shark\nA: A lone shark', by='shark')
```
### Buffalo
```{r}
say('Q: What do you call a single buffalo?\nA: A buffalonely', by='buffalo')
```
### Clippy
```{r}
say(fortune=59, by="clippy")
```
### Yoda
```{r eval=FALSE}
say("fortune", by = "yoda")
```
### Bats!
```{r}
say("hi, i'm a bat", by="bat")
```
See also `bat2`
### Monkey!
```{r}
say("fortune", by = "monkey")
```
### Daemon!
```{r}
say("fortune", by = "daemon")
```
### Egret
```{r}
say("je ne regrette rien", by = "egret")
```
See also `bat2`
### Endless horse
```{r eval=FALSE}
endless_horse()
## -----
## Hello world!
## ------
## \
## \
## \
## ,
## _,,)\.~,,._
## (()` ``)\))),,_
## | \ ''((\)))),,_ ____
## |6` | ''((\())) "-.____.-" `-.-,
## | .'\ ''))))' \)))
## | | `. '' ((((
## \, _) \/ |))))
## `' | (((((
## \ | ))))))
## `| | ,\ /((((((
## | / `-.______.< \ | )))))
## | | / `. \ \ ((((
## | / \ | `.\ | (((
## \ | | | )| | ))
## | | | | || | ' [endless.horse]
## | | | | || |
##
## | | | | || |
## | | | | || |
## | | | | || |
## | | | | || |
## | | | | || |
## | | | | || |
## | | | | || |
## | | | | || |
## | | | | || |
## | | | | || |
```
### Using pipes
```{r}
library("magrittr")
"I HAD FUN ONCE, IT WAS AWFUL" %>% say('grumpycat')
```
### I just want the animals!
Okay, hold your endless horses. Just use the exported vector `animals`, and you can select the animal you want by name.
```{r}
animals['clippy']
```
## Meta
* License: MIT
* Please note that this project is released with a [Contributor Code of Conduct][coc]. By participating in this project you agree to abide by its terms.
[coc]: https://github.com/sckott/cowsay/blob/main/.github/CODE_OF_CONDUCT.md
[contrib]: https://github.com/sckott/cowsay/blob/main/.github/CONTRIBUTING.md