Debian Codegraph @

tests/testthat/_snaps/ctl_colonnade.md

raw symbols SCIP
1 # output test
2
3 Code
4 ctl_colonnade(rep(list(paste(letters, collapse = " ")), 4), width = Inf)
5 Output
6 $body
7 ``
8 <chr>
9 1 a b c d e f g h i j k l m n o p q r s t u v w x y z
10 ``
11 <chr>
12 1 a b c d e f g h i j k l m n o p q r s t u v w x y z
13 ``
14 <chr>
15 1 a b c d e f g h i j k l m n o p q r s t u v w x y z
16 ``
17 <chr>
18 1 a b c d e f g h i j k l m n o p q r s t u v w x y z
19
20 $extra_cols
21 list()
22
23 $abbrev_cols
24 character(0)
25
26 $abbrev_col_idxs
27 numeric(0)
28
29
30 # tests from tibble
31
32 Code
33 ctl_colonnade(mtcars[1:8, ], has_row_id = "*", width = 30)
34 Output
35 $body
36 mpg cyl disp hp
37 * <dbl> <dbl> <dbl> <dbl>
38 1 21 6 160 110
39 2 21 6 160 110
40 3 22.8 4 108 93
41 4 21.4 6 258 110
42 5 18.7 8 360 175
43 6 18.1 6 225 105
44 7 14.3 8 360 245
45 8 24.4 4 147. 62
46
47 $extra_cols
48 $extra_cols$drat
49 [1] 3.90 3.90 3.85 3.08 3.15 2.76 3.21 3.69
50
51 $extra_cols$wt
52 [1] 2.620 2.875 2.320 3.215 3.440 3.460 3.570 3.190
53
54 $extra_cols$qsec
55 [1] 16.46 17.02 18.61 19.44 17.02 20.22 15.84 20.00
56
57 $extra_cols$vs
58 [1] 0 0 1 1 0 1 0 1
59
60 $extra_cols$am
61 [1] 1 1 1 0 0 0 0 0
62
63 $extra_cols$gear
64 [1] 4 4 4 3 3 3 3 4
65
66 $extra_cols$carb
67 [1] 4 4 1 1 2 1 4 2
68
69
70 $abbrev_cols
71 character(0)
72
73 $abbrev_col_idxs
74 numeric(0)
75
76 Code
77 ctl_colonnade(trees[1:5, ], width = 20)
78 Output
79 $body
80 Girth Height
81 <dbl> <dbl>
82 1 8.3 70
83 2 8.6 65
84 3 8.8 63
85 4 10.5 72
86 5 10.7 81
87
88 $extra_cols
89 $extra_cols$Volume
90 [1] 10.3 10.3 10.2 16.4 18.8
91
92
93 $abbrev_cols
94 character(0)
95
96 $abbrev_col_idxs
97 numeric(0)
98
99 Code
100 ctl_colonnade(trees[1:5, ], width = 10)
101 Output
102 $body
103 Girth
104 <dbl>
105 1 8.3
106 2 8.6
107 3 8.8
108 4 10.5
109 5 10.7
110
111 $extra_cols
112 $extra_cols$Height
113 [1] 70 65 63 72 81
114
115 $extra_cols$Volume
116 [1] 10.3 10.3 10.2 16.4 18.8
117
118
119 $abbrev_cols
120 character(0)
121
122 $abbrev_col_idxs
123 numeric(0)
124
125 Code
126 ctl_colonnade(trees[1:3, ], width = 10)
127 Output
128 $body
129 Girth
130 <dbl>
131 1 8.3
132 2 8.6
133 3 8.8
134
135 $extra_cols
136 $extra_cols$Height
137 [1] 70 65 63
138
139 $extra_cols$Volume
140 [1] 10.3 10.3 10.2
141
142
143 $abbrev_cols
144 character(0)
145
146 $abbrev_col_idxs
147 numeric(0)
148
149 Code
150 ctl_colonnade(df_all, width = 30)
151 Output
152 $body
153 a b c d
154 <dbl> <int> <lgl> <chr>
155 1 1 1 TRUE a
156 2 2.5 2 FALSE b
157 3 NA NA NA <NA>
158
159 $extra_cols
160 $extra_cols$e
161 [1] a b <NA>
162 Levels: a b
163
164 $extra_cols$f
165 [1] "2015-12-10" "2015-12-11" NA
166
167 $extra_cols$g
168 [1] "2015-12-09 10:51:35 UTC" "2015-12-09 10:51:36 UTC"
169 [3] NA
170
171 $extra_cols$h
172 $extra_cols$h[[1]]
173 [1] 1
174
175 $extra_cols$h[[2]]
176 [1] 2
177
178 $extra_cols$h[[3]]
179 [1] NA
180
181
182 $extra_cols$i
183 $extra_cols$i[[1]]
184 $extra_cols$i[[1]][[1]]
185 [1] 1
186
187 $extra_cols$i[[1]][[2]]
188 [1] 2 3
189
190
191 $extra_cols$i[[2]]
192 $extra_cols$i[[2]][[1]]
193 [1] 4 5 6
194
195
196 $extra_cols$i[[3]]
197 $extra_cols$i[[3]][[1]]
198 [1] NA
199
200
201
202
203 $abbrev_cols
204 character(0)
205
206 $abbrev_col_idxs
207 numeric(0)
208
209 Code
210 ctl_colonnade(df_all, width = 300)
211 Output
212 $body
213 a b c d e f g h
214 <dbl> <int> <lgl> <chr> <fct> <date> <dttm> <list>
215 1 1 1 TRUE a a 2015-12-10 2015-12-09 10:51:35 <int [1]>
216 2 2.5 2 FALSE b b 2015-12-11 2015-12-09 10:51:36 <int [1]>
217 3 NA NA NA <NA> <NA> NA NA <int [1]>
218 i
219 <list>
220 1 <list [2]>
221 2 <list [1]>
222 3 <list [1]>
223
224 $extra_cols
225 list()
226
227 $abbrev_cols
228 character(0)
229
230 $abbrev_col_idxs
231 numeric(0)
232
233 Code
234 options(width = 70)
235 ctl_colonnade(df_all, width = 300)
236 Output
237 $body
238 a b c d e f g
239 <dbl> <int> <lgl> <chr> <fct> <date> <dttm>
240 1 1 1 TRUE a a 2015-12-10 2015-12-09 10:51:35
241 2 2.5 2 FALSE b b 2015-12-11 2015-12-09 10:51:36
242 3 NA NA NA <NA> <NA> NA NA
243 h i
244 <list> <list>
245 1 <int [1]> <list [2]>
246 2 <int [1]> <list [1]>
247 3 <int [1]> <list [1]>
248
249 $extra_cols
250 list()
251
252 $abbrev_cols
253 character(0)
254
255 $abbrev_col_idxs
256 numeric(0)
257
258 Code
259 options(width = 60)
260 ctl_colonnade(df_all, width = 300)
261 Output
262 $body
263 a b c d e f
264 <dbl> <int> <lgl> <chr> <fct> <date>
265 1 1 1 TRUE a a 2015-12-10
266 2 2.5 2 FALSE b b 2015-12-11
267 3 NA NA NA <NA> <NA> NA
268 g h i
269 <dttm> <list> <list>
270 1 2015-12-09 10:51:35 <int [1]> <list [2]>
271 2 2015-12-09 10:51:36 <int [1]> <list [1]>
272 3 NA <int [1]> <list [1]>
273
274 $extra_cols
275 list()
276
277 $abbrev_cols
278 character(0)
279
280 $abbrev_col_idxs
281 numeric(0)
282
283 Code
284 options(width = 50)
285 ctl_colonnade(df_all, width = 300)
286 Output
287 $body
288 a b c d e f
289 <dbl> <int> <lgl> <chr> <fct> <date>
290 1 1 1 TRUE a a 2015-12-10
291 2 2.5 2 FALSE b b 2015-12-11
292 3 NA NA NA <NA> <NA> NA
293 g h i
294 <dttm> <list> <list>
295 1 2015-12-09 10:51:35 <int [1]> <list [2]>
296 2 2015-12-09 10:51:36 <int [1]> <list [1]>
297 3 NA <int [1]> <list [1]>
298
299 $extra_cols
300 list()
301
302 $abbrev_cols
303 character(0)
304
305 $abbrev_col_idxs
306 numeric(0)
307
308 Code
309 options(width = 40)
310 ctl_colonnade(df_all, width = 300)
311 Output
312 $body
313 a b c d e
314 <dbl> <int> <lgl> <chr> <fct>
315 1 1 1 TRUE a a
316 2 2.5 2 FALSE b b
317 3 NA NA NA <NA> <NA>
318 f g
319 <date> <dttm>
320 1 2015-12-10 2015-12-09 10:51:35
321 2 2015-12-11 2015-12-09 10:51:36
322 3 NA NA
323 h i
324 <list> <list>
325 1 <int [1]> <list [2]>
326 2 <int [1]> <list [1]>
327 3 <int [1]> <list [1]>
328
329 $extra_cols
330 list()
331
332 $abbrev_cols
333 character(0)
334
335 $abbrev_col_idxs
336 numeric(0)
337
338 Code
339 options(width = 30)
340 ctl_colonnade(df_all, width = 300)
341 Output
342 $body
343 a b c d
344 <dbl> <int> <lgl> <chr>
345 1 1 1 TRUE a
346 2 2.5 2 FALSE b
347 3 NA NA NA <NA>
348 e f
349 <fct> <date>
350 1 a 2015-12-10
351 2 b 2015-12-11
352 3 <NA> NA
353 g
354 <dttm>
355 1 2015-12-09 10:51:35
356 2 2015-12-09 10:51:36
357 3 NA
358 h i
359 <list> <list>
360 1 <int [1]> <list [2]>
361 2 <int [1]> <list [1]>
362 3 <int [1]> <list [1]>
363
364 $extra_cols
365 list()
366
367 $abbrev_cols
368 character(0)
369
370 $abbrev_col_idxs
371 numeric(0)
372
373 Code
374 options(width = 20)
375 ctl_colonnade(df_all, width = 300)
376 Output
377 $body
378 a b c
379 <dbl> <int> <lgl>
380 1 1 1 TRUE
381 2 2.5 2 FALSE
382 3 NA NA NA
383 d e
384 <chr> <fct>
385 1 a a
386 2 b b
387 3 <NA> <NA>
388 f
389 <date>
390 1 2015-12-10
391 2 2015-12-11
392 3 NA
393
394 $extra_cols
395 $extra_cols$g
396 [1] "2015-12-09 10:51:35 UTC"
397 [2] "2015-12-09 10:51:36 UTC"
398 [3] NA
399
400 $extra_cols$h
401 $extra_cols$h[[1]]
402 [1] 1
403
404 $extra_cols$h[[2]]
405 [1] 2
406
407 $extra_cols$h[[3]]
408 [1] NA
409
410
411 $extra_cols$i
412 $extra_cols$i[[1]]
413 $extra_cols$i[[1]][[1]]
414 [1] 1
415
416 $extra_cols$i[[1]][[2]]
417 [1] 2 3
418
419
420 $extra_cols$i[[2]]
421 $extra_cols$i[[2]][[1]]
422 [1] 4 5 6
423
424
425 $extra_cols$i[[3]]
426 $extra_cols$i[[3]][[1]]
427 [1] NA
428
429
430
431
432 $abbrev_cols
433 character(0)
434
435 $abbrev_col_idxs
436 numeric(0)
437
438 Code
439 list_with_ctl <- list(c("\n", "\""), factor(c("\n", "\n")))
440 names(list_with_ctl) <- c("\n", "\r")
441 ctl_colonnade(list_with_ctl, width = 30)
442 Output
443 $body
444 `\n` `\r`
445 <chr> <fct>
446 1 "\n" "\n"
447 2 "\"" "\n"
448
449 $extra_cols
450 list()
451
452 $abbrev_cols
453 character(0)
454
455 $abbrev_col_idxs
456 numeric(0)
457
458 Code
459 ctl_colonnade(list(a = c("", " ", "a ", " a")), width = 30)
460 Output
461 $body
462 a
463 <chr>
464 1 ""
465 2 " "
466 3 "a "
467 4 " a"
468
469 $extra_cols
470 list()
471
472 $abbrev_cols
473 character(0)
474
475 $abbrev_col_idxs
476 numeric(0)
477
478 Code
479 ctl_colonnade(list(`mean(x)` = 5, `var(x)` = 3), width = 30)
480 Output
481 $body
482 `mean(x)` `var(x)`
483 <dbl> <dbl>
484 1 5 3
485
486 $extra_cols
487 list()
488
489 $abbrev_cols
490 character(0)
491
492 $abbrev_col_idxs
493 numeric(0)
494
495
496 # NA names
497
498 Code
499 x <- list(`NA` = 1:3, set_to_NA = 4:6)
500 names(x)[[2]] <- NA_character_
501 ctl_colonnade(x, width = 30)
502 Output
503 $body
504 `NA` ``
505 <int> <int>
506 1 1 4
507 2 2 5
508 3 3 6
509
510 $extra_cols
511 list()
512
513 $abbrev_cols
514 character(0)
515
516 $abbrev_col_idxs
517 numeric(0)
518
519
520 # sep argument
521
522 Code
523 ctl_colonnade(x, width = 30)
524 Output
525 $body
526 sep
527 <int>
528 1 1
529 2 2
530 3 3
531
532 $extra_cols
533 list()
534
535 $abbrev_cols
536 character(0)
537
538 $abbrev_col_idxs
539 numeric(0)
540
541 Code
542 # dummy
543
544 # tibble columns
545
546 Code
547 ctl_colonnade(x, width = 30)
548 Output
549 $body
550 a b$c $d
551 <int> <int> <int>
552 1 1 4 7
553 2 2 5 8
554 3 3 6 9
555
556 $extra_cols
557 list()
558
559 $abbrev_cols
560 character(0)
561
562 $abbrev_col_idxs
563 numeric(0)
564
565
566 # tibble columns (nested)
567
568 Code
569 ctl_colonnade(x, width = 40)
570 Output
571 $body
572 a b$c $d $e$f$g $$$h
573 <int> <int> <int> <int> <int>
574 1 1 4 7 10 13
575 2 2 5 8 11 14
576 3 3 6 9 12 15
577
578 $extra_cols
579 list()
580
581 $abbrev_cols
582 character(0)
583
584 $abbrev_col_idxs
585 numeric(0)
586
587
588 # tibble columns (empty)
589
590 Code
591 ctl_colonnade(x, width = 40)
592 Output
593 $body
594 a b$c $d $e c
595 <int> <int> <int> <df[,0]> <int>
596 1 1 4 7 10
597 2 2 5 8 11
598 3 3 6 9 12
599
600 $extra_cols
601 list()
602
603 $abbrev_cols
604 character(0)
605
606 $abbrev_col_idxs
607 numeric(0)
608
609
610 # matrix columns (unnamed)
611
612 Code
613 ctl_colonnade(x, width = 30)
614 Output
615 $body
616 a b[,1] [,2]
617 <int> <int> <int>
618 1 1 4 7
619 2 2 5 8
620 3 3 6 9
621
622 $extra_cols
623 list()
624
625 $abbrev_cols
626 character(0)
627
628 $abbrev_col_idxs
629 numeric(0)
630
631
632 # matrix columns (named)
633
634 Code
635 ctl_colonnade(x, width = 30)
636 Output
637 $body
638 a b[,"c"] [,"d"]
639 <int> <int> <int>
640 1 1 4 7
641 2 2 5 8
642 3 3 6 9
643
644 $extra_cols
645 list()
646
647 $abbrev_cols
648 character(0)
649
650 $abbrev_col_idxs
651 numeric(0)
652
653
654 # matrix columns (empty)
655
656 Code
657 ctl_colonnade(list(a = 1:3, b = matrix(4:6, ncol = 1)[, 0], c = 4:6), width = 30)
658 Output
659 $body
660 a b c
661 <int> <int[,0]> <int>
662 1 1 4
663 2 2 5
664 3 3 6
665
666 $extra_cols
667 list()
668
669 $abbrev_cols
670 character(0)
671
672 $abbrev_col_idxs
673 numeric(0)
674
675
676 # filling unused width (#331)
677
678 Code
679 data
680 Output
681 # A data frame: 1 x 3
682 month sentences blah
683 <chr> <foo> <chr>
684 1 January a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I~
685 Code
686 options(width = 60)
687 print(data)
688 Output
689 # A data frame: 1 x 3
690 month sentences blah
691 <chr> <foo> <chr>
692 1 January a b c d~ A B C D E F G H I J K L M N O P Q R S T~
693