pillar/0000755000176200001440000000000013206765060011542 5ustar liggesuserspillar/tests/0000755000176200001440000000000013204561023012673 5ustar liggesuserspillar/tests/testthat.R0000644000176200001440000000007013204561023014653 0ustar liggesuserslibrary(testthat) library(pillar) test_check("pillar") pillar/tests/testthat/0000755000176200001440000000000013206765060014544 5ustar liggesuserspillar/tests/testthat/test-format_factor.R0000644000176200001440000000044413204561023020463 0ustar liggesuserscontext("format_factor") test_that("output test", { expect_pillar_output(xp = factor(c(letters[1:5], NA)), filename = "factor.txt") expect_pillar_output(xp = ordered(c(letters[1:5], NA)), filename = "ordered.txt") expect_pillar_output(xp = factor("a\nb"), filename = "escaped.txt") }) pillar/tests/testthat/test-title.R0000644000176200001440000000104513204561023016754 0ustar liggesuserscontext("title") test_that("with and without title", { expect_pillar_output(10 ^ (1:6), filename = "title-none.txt", crayon = FALSE) expect_pillar_output(10 ^ (1:6), title = "crayon", filename = "title-crayon.txt") expect_pillar_output(10 ^ (1:6), title = "short", filename = "title-short.txt", crayon = FALSE) expect_pillar_output(10 ^ (1:6), title = "somewhat_wider", filename = "title-longer.txt", crayon = FALSE) expect_pillar_output(10 ^ (1:6), title = "much_too_wide", width = 7, filename = "title-too-long.txt", crayon = FALSE) }) pillar/tests/testthat/out-native/0000755000176200001440000000000013206761663016644 5ustar liggesuserspillar/tests/testthat/out-native/tibble-all--300-30.txt0000644000176200001440000000070713204561027022203 0ustar liggesusers a b c d 1 1.00 1 T a 2 2.50 2 F b 3 NA NA NA e f 1 a 2015-12-10 2 b 2015-12-11 3 NA g 1 2015-12-09 10:51:35 2 2015-12-09 10:51:36 3 NA h i 1 2 3 pillar/tests/testthat/out-native/numeric-22.txt0000644000176200001440000000016313204561023021252 0ustar liggesusers 0.00000000100 0.00000100 1000 1000000000 pillar/tests/testthat/out-native/numeric-04.txt0000644000176200001440000000005013204561023021245 0ustar liggesusers 1.00e-9 1.00e-6 1.00e+3 1.00e+9 pillar/tests/testthat/out-native/tibble-all--30.txt0000644000176200001440000000020213204561027021671 0ustar liggesusers a b c d 1 1.00 1 T a 2 2.50 2 F b 3 NA NA NA pillar/tests/testthat/out-native/multi-22.txt0000644000176200001440000000015613204561023020744 0ustar liggesusers column~ col_~ col_~ 1 1.23 a a 2 2.23 b b 3 3.23 c c pillar/tests/testthat/out-native/letters.txt0000644000176200001440000000005213204561023021046 0ustar liggesusers a b c d e pillar/tests/testthat/out-native/multi-13.txt0000644000176200001440000000010113204561023020732 0ustar liggesusers column_ze~ 1 1.23 2 2.23 3 3.23 pillar/tests/testthat/out-native/list-na.txt0000644000176200001440000000003613204561023020735 0ustar liggesusers pillar/tests/testthat/out-native/tibble-all--300-20.txt0000644000176200001440000000036013204561027022175 0ustar liggesusers a b c 1 1.00 1 T 2 2.50 2 F 3 NA NA NA d e 1 a a 2 b b 3 f 1 2015-12-10 2 2015-12-11 3 NA pillar/tests/testthat/out-native/multi-27.txt0000644000176200001440000000020713204561023020746 0ustar liggesusers colum~ col_~ col_~ col_~ 1 1.23 a a a 2 2.23 b b b 3 3.23 c c c pillar/tests/testthat/out-native/scientific-short-neg.txt0000644000176200001440000000013013204561023023405 0ustar liggesusers - 1.00e 3 1.00e 9 - 1.00e15 1.00e22 NA -Inf Inf pillar/tests/testthat/out-native/multi-09.txt0000644000176200001440000000005513204561023020747 0ustar liggesusers colum~ 1 1.23 2 2.23 3 3.23 pillar/tests/testthat/out-native/multi-14.txt0000644000176200001440000000010613204561023020740 0ustar liggesusers colu~ col_~ 1 1.23 a 2 2.23 b 3 3.23 c pillar/tests/testthat/out-native/multi-extra-10.txt0000644000176200001440000000005013204561027022057 0ustar liggesuserscol_02 col_03 col_04 pillar/tests/testthat/out-native/multi-17.txt0000644000176200001440000000012513204561023020744 0ustar liggesusers column_~ col_~ 1 1.23 a 2 2.23 b 3 3.23 c pillar/tests/testthat/out-native/multi-30.txt0000644000176200001440000000022613204561023020741 0ustar liggesusers column_z~ col_~ col_~ col_~ 1 1.23 a a a 2 2.23 b b b 3 3.23 c c c pillar/tests/testthat/out-native/escaped.txt0000644000176200001440000000001613204561023020770 0ustar liggesusers "a\nb" pillar/tests/testthat/out-native/multi-06.txt0000644000176200001440000000000013204561023020732 0ustar liggesuserspillar/tests/testthat/out-native/multi-18.txt0000644000176200001440000000013213204561023020743 0ustar liggesusers column_z~ col_~ 1 1.23 a 2 2.23 b 3 3.23 c pillar/tests/testthat/out-native/integer-07.txt0000644000176200001440000000005013204561023021243 0ustar liggesusers 1.00e7 1.00e7 1.00e7 NA pillar/tests/testthat/out-native/ordered.txt0000644000176200001440000000005213204561023021010 0ustar liggesusers a b c d e pillar/tests/testthat/out-native/numeric-10.txt0000644000176200001440000000006713204561023021252 0ustar liggesusers 1.00e-9 1.00e-6 1.00e+3 1.00e+9 pillar/tests/testthat/out-native/multi-04.txt0000644000176200001440000000000013204561023020730 0ustar liggesuserspillar/tests/testthat/out-native/multi-08.txt0000644000176200001440000000005013204561023020741 0ustar liggesusers colu~ 1 1.23 2 2.23 3 3.23 pillar/tests/testthat/out-native/multi-24.txt0000644000176200001440000000017013204561023020742 0ustar liggesusers column_z~ col_~ col_~ 1 1.23 a a 2 2.23 b b 3 3.23 c c pillar/tests/testthat/out-native/multi-34.txt0000644000176200001440000000025213204561023020744 0ustar liggesusers column_zero~ col_02 col_~ col_~ 1 1.23 a a a 2 2.23 b b b 3 3.23 c c c pillar/tests/testthat/out-native/multi-38.txt0000644000176200001440000000027613204561023020756 0ustar liggesusers column_zero_one col_02 col_03 col_~ 1 1.23 a a a 2 2.23 b b b 3 3.23 c c c pillar/tests/testthat/out-native/deal2.txt0000644000176200001440000000012213206761663020367 0ustar liggesusers`` "\u6210\u4ea4" pillar/tests/testthat/out-native/list-each.txt0000644000176200001440000000005013204561023021233 0ustar liggesusers pillar/tests/testthat/out-native/integer-08.txt0000644000176200001440000000005513204561023021251 0ustar liggesusers 10000001 10000002 10000003 NA pillar/tests/testthat/out-native/date.txt0000644000176200001440000000004113204561023020277 0ustar liggesusers 2017-07-28 NA pillar/tests/testthat/out-native/tibble-all--300.txt0000644000176200001440000000066313204561027021764 0ustar liggesusers a b c d e f g h 1 1.00 1 T a a 2015-12-10 2015-12-09 10:51:35 2 2.50 2 F b b 2015-12-11 2015-12-09 10:51:36 3 NA NA NA NA NA i 1 2 3 pillar/tests/testthat/out-native/multi-05.txt0000644000176200001440000000000013204561023020731 0ustar liggesuserspillar/tests/testthat/out-native/multi-36.txt0000644000176200001440000000026413204561023020751 0ustar liggesusers column_zero_one col_~ col_~ col_~ 1 1.23 a a a 2 2.23 b b b 3 3.23 c c c pillar/tests/testthat/out-native/rowid-3.txt0000644000176200001440000000001013204561023020642 0ustar liggesusers 1 2 3 pillar/tests/testthat/out-native/multi-12.txt0000644000176200001440000000007413204561023020742 0ustar liggesusers column_z~ 1 1.23 2 2.23 3 3.23 pillar/tests/testthat/out-native/multi-11.txt0000644000176200001440000000006713204561023020743 0ustar liggesusers column_~ 1 1.23 2 2.23 3 3.23 pillar/tests/testthat/out-native/multi-16.txt0000644000176200001440000000012013204561023020736 0ustar liggesusers column~ col_~ 1 1.23 a 2 2.23 b 3 3.23 c pillar/tests/testthat/out-native/factor.txt0000644000176200001440000000006113204561023020642 0ustar liggesusers a b c d e pillar/tests/testthat/out-native/list-narrow.txt0000644000176200001440000000002613204561023021646 0ustar liggesusers "" " " " a" "a " a b pillar/tests/testthat/out-native/tibble-iris-5-30.txt0000644000176200001440000000032213204561023022153 0ustar liggesusers Sepal.~ Sepal~ Petal~ Peta~ 1 5.10 3.50 1.40 0.200 2 4.90 3.00 1.40 0.200 3 4.70 3.20 1.30 0.200 4 4.60 3.10 1.50 0.200 5 5.00 3.60 1.40 0.200 pillar/tests/testthat/out-native/multi-39.txt0000644000176200001440000000030313204561023020746 0ustar liggesusers column_zero_one col_02 col_03 col_04 1 1.23 a a a 2 2.23 b b b 3 3.23 c c c pillar/tests/testthat/out-native/tibble-non-syntactic.txt0000644000176200001440000000007713204561023023423 0ustar liggesusers `mean(x)` `var(x)` 1 5.00 3.00 pillar/tests/testthat/out-native/multi-29.txt0000644000176200001440000000022113204561023020744 0ustar liggesusers column_~ col_~ col_~ col_~ 1 1.23 a a a 2 2.23 b b b 3 3.23 c c c pillar/tests/testthat/out-native/multi-21.txt0000644000176200001440000000015113204561023020736 0ustar liggesusers colum~ col_~ col_~ 1 1.23 a a 2 2.23 b b 3 3.23 c c pillar/tests/testthat/out-native/asis-list.txt0000644000176200001440000000005013204561023021272 0ustar liggesusers pillar/tests/testthat/out-native/logical.txt0000644000176200001440000000003013204561023020772 0ustar liggesusers T F NA pillar/tests/testthat/out-native/letters-long-03.txt0000644000176200001440000000002213204561023022220 0ustar liggesusers abcd~ pillar/tests/testthat/out-native/multi-inf.txt0000644000176200001440000000030313204561023021267 0ustar liggesusers column_zero_one col_02 col_03 col_04 1 1.23 a a a 2 2.23 b b b 3 3.23 c c c pillar/tests/testthat/out-native/numeric-15.txt0000644000176200001440000000012013204561023021245 0ustar liggesusers 1.00e-9 1.00e-6 1.00e+3 1.00e+9 pillar/tests/testthat/out-native/multi-10.txt0000644000176200001440000000006213204561023020735 0ustar liggesusers column~ 1 1.23 2 2.23 3 3.23 pillar/tests/testthat/out-native/multi-33.txt0000644000176200001440000000024513204561023020745 0ustar liggesusers column_zer~ col_02 col_~ col_~ 1 1.23 a a a 2 2.23 b b b 3 3.23 c c c pillar/tests/testthat/out-native/integer-06.txt0000644000176200001440000000005013204561023021242 0ustar liggesusers 1.00e7 1.00e7 1.00e7 NA pillar/tests/testthat/out-native/tibble-all--300-70.txt0000644000176200001440000000066313204561027022210 0ustar liggesusers a b c d e f g 1 1.00 1 T a a 2015-12-10 2015-12-09 10:51:35 2 2.50 2 F b b 2015-12-11 2015-12-09 10:51:36 3 NA NA NA NA NA h i 1 2 3 pillar/tests/testthat/out-native/tibble-all--300-40.txt0000644000176200001440000000067513204561027022210 0ustar liggesusers a b c d e 1 1.00 1 T a a 2 2.50 2 F b b 3 NA NA NA f g 1 2015-12-10 2015-12-09 10:51:35 2 2015-12-11 2015-12-09 10:51:36 3 NA NA h i 1 2 3 pillar/tests/testthat/out-native/title-short.txt0000644000176200001440000000017113204561023021644 0ustar liggesusers short 10.0 100 1000 10000 100000 1000000 NA - Inf Inf pillar/tests/testthat/out-native/multi-07.txt0000644000176200001440000000000013204561023020733 0ustar liggesuserspillar/tests/testthat/out-native/tibble-iris-3-20.txt0000644000176200001440000000014413204561023022152 0ustar liggesusers Sepa~ Sepa~ Peta~ 1 5.10 3.50 1.40 2 4.90 3.00 1.40 3 4.70 3.20 1.30 pillar/tests/testthat/out-native/multi-19.txt0000644000176200001440000000013713204561023020751 0ustar liggesusers column_ze~ col_~ 1 1.23 a 2 2.23 b 3 3.23 c pillar/tests/testthat/out-native/tibble-space.txt0000644000176200001440000000006013204561027021721 0ustar liggesusers a 1 "" 2 " " 3 "a " 4 " a" pillar/tests/testthat/out-native/title-crayon.txt0000644000176200001440000000017113204561023022000 0ustar liggesusers crayon 10.0 100 1000 10000 100000 1000000 NA - Inf Inf pillar/tests/testthat/out-native/multi-37.txt0000644000176200001440000000027113204561023020750 0ustar liggesusers column_zero_one col_02 col_~ col_~ 1 1.23 a a a 2 2.23 b b b 3 3.23 c c c pillar/tests/testthat/out-native/rowid-star-title-12.txt0000644000176200001440000000005213204561023023016 0ustar liggesusers * 1 2 3 4 5 6 7 8 9 10 11 12 pillar/tests/testthat/out-native/basic.txt0000644000176200001440000000023413204561023020447 0ustar liggesusers - 0.00100 0.0100 - 0.100 1.00 - 10.0 100 - 1000 10000 NA - Inf Inf pillar/tests/testthat/out-native/tibble-newline.txt0000644000176200001440000000007413204561027022274 0ustar liggesusers `\n` `\r` 1 "\n" "\n" 2 "\"" "\n" pillar/tests/testthat/out-native/multi-31.txt0000644000176200001440000000023313204561023020740 0ustar liggesusers column_z~ col_02 col_~ col_~ 1 1.23 a a a 2 2.23 b b b 3 3.23 c c c pillar/tests/testthat/out-native/multi-35.txt0000644000176200001440000000025713204561023020752 0ustar liggesusers column_zero~ col_02 col_03 col_~ 1 1.23 a a a 2 2.23 b b b 3 3.23 c c c pillar/tests/testthat/out-native/multi-23.txt0000644000176200001440000000016313204561023020743 0ustar liggesusers column_~ col_~ col_~ 1 1.23 a a 2 2.23 b b 3 3.23 c c pillar/tests/testthat/out-native/list-null.txt0000644000176200001440000000003613204561023021311 0ustar liggesusers pillar/tests/testthat/out-native/multi-26.txt0000644000176200001440000000020213204561023020740 0ustar liggesusers colu~ col_~ col_~ col_~ 1 1.23 a a a 2 2.23 b b b 3 3.23 c c c pillar/tests/testthat/out-native/tibble-mtcars-8-30.txt0000644000176200001440000000040413204561023022502 0ustar liggesusers mpg cyl disp hp * 1 21.0 6.00 160 110 2 21.0 6.00 160 110 3 22.8 4.00 108 93.0 4 21.4 6.00 258 110 5 18.7 8.00 360 175 6 18.1 6.00 225 105 7 14.3 8.00 360 245 8 24.4 4.00 147 62.0 pillar/tests/testthat/out-native/time-posix.txt0000644000176200001440000000007413204561023021466 0ustar liggesusers 2017-07-28 18:04:35 NA pillar/tests/testthat/out-native/deal3.txt0000644000176200001440000000006613204561027020365 0ustar liggesusers`` 1 NA pillar/tests/testthat/out-native/utf8.txt0000644000176200001440000000265313204561027020267 0ustar liggesusers chars desc 1 "\u0001\u001f" C0 control c~ 2 "\a\b\f\n\r\t" Named contro~ 3 abcdefuvwxyz ASCII 4 "\u0080\u009f" C1 control c~ 5 Latin-1 6 AaAaAaCcCcCc Unicode 7 !"#$%& Unicode wide 8 "\u0e00\u2029" Unicode cont~ 9 "xxxxxxxxx\U000e0001x\U000e0020x\U000e01efx" Unicode igno~ 10 a`aa^a~aaaaaaaa Unicode mark 11 "\U0001f600\U0001f601\U0001f602\U0001f603\U0001f604\U0001f483" Emoji 12 "x\U0010ffffx" Unassigned 13 "\xfd\xfe\xff" Invalid 14 "\\" Backslash 15 "\"" Quote pillar/tests/testthat/out-native/time.txt0000644000176200001440000000007413204561023020326 0ustar liggesusers 2017-07-28 18:04:35 NA pillar/tests/testthat/out-native/asis-number.txt0000644000176200001440000000004413204561023021612 0ustar liggesusers 1 2 3 pillar/tests/testthat/out-native/tibble-all--300-60.txt0000644000176200001440000000066313204561027022207 0ustar liggesusers a b c d e f 1 1.00 1 T a a 2015-12-10 2 2.50 2 F b b 2015-12-11 3 NA NA NA NA g h i 1 2015-12-09 10:51:35 2 2015-12-09 10:51:36 3 NA pillar/tests/testthat/out-native/multi-32.txt0000644000176200001440000000024013204561023020737 0ustar liggesusers column_ze~ col_02 col_~ col_~ 1 1.23 a a a 2 2.23 b b b 3 3.23 c c c pillar/tests/testthat/out-native/tibble-all--300-50.txt0000644000176200001440000000066313204561027022206 0ustar liggesusers a b c d e f 1 1.00 1 T a a 2015-12-10 2 2.50 2 F b b 2015-12-11 3 NA NA NA NA g h i 1 2015-12-09 10:51:35 2 2015-12-09 10:51:36 3 NA pillar/tests/testthat/out-native/multi-15.txt0000644000176200001440000000011313204561023020737 0ustar liggesusers colum~ col_~ 1 1.23 a 2 2.23 b 3 3.23 c pillar/tests/testthat/out-native/letters-long.txt0000644000176200001440000000012113204561023022000 0ustar liggesusers abcdefghijklmnopqrstuvwxyz pillar/tests/testthat/out-native/title-too-long.txt0000644000176200001440000000015613204561023022246 0ustar liggesusersmuch_too~ 1.00e1 1.00e2 1.00e3 1.00e4 1.00e5 1.00e6 NA -Inf Inf pillar/tests/testthat/out-native/multi-28.txt0000644000176200001440000000021413204561023020745 0ustar liggesusers column~ col_~ col_~ col_~ 1 1.23 a a a 2 2.23 b b b 3 3.23 c c c pillar/tests/testthat/out-native/integer-09.txt0000644000176200001440000000006213204561023021250 0ustar liggesusers 10000001 10000002 10000003 NA pillar/tests/testthat/out-native/scientific.txt0000644000176200001440000000013013204561023021501 0ustar liggesusers 1.00e-9 1.00e-6 1.00e+3 1.00e+9 NA -Inf Inf pillar/tests/testthat/out-native/multi-20.txt0000644000176200001440000000014413204561023020737 0ustar liggesusers colu~ col_~ col_~ 1 1.23 a a 2 2.23 b b 3 3.23 c c pillar/tests/testthat/out-native/deal1.txt0000644000176200001440000000014413206761663020372 0ustar liggesusers`` "\u6210\u4ea4\u65e5" pillar/tests/testthat/out-native/letters-long-10.txt0000644000176200001440000000004113204561023022217 0ustar liggesusers abcdefghi~ pillar/tests/testthat/out-native/numeric-07.txt0000644000176200001440000000005013204561023021250 0ustar liggesusers 1.00e-9 1.00e-6 1.00e+3 1.00e+9 pillar/tests/testthat/out-native/decimal-insignif.txt0000644000176200001440000000020413204561023022565 0ustar liggesusers 0.00123 0.0123 0.123 1.23 12.3 123 1235 NA - Inf Inf pillar/tests/testthat/out-native/title-none.txt0000644000176200001440000000015613204561023021447 0ustar liggesusers 10.0 100 1000 10000 100000 1000000 NA - Inf Inf pillar/tests/testthat/out-native/multi-25.txt0000644000176200001440000000017513204561023020750 0ustar liggesusers column_ze~ col_~ col_~ 1 1.23 a a 2 2.23 b b 3 3.23 c c pillar/tests/testthat/out-native/title-longer.txt0000644000176200001440000000024513204561023021775 0ustar liggesuserssomewhat_wider 10.0 100 1000 10000 100000 1000000 NA - Inf Inf pillar/tests/testthat/test-format_rowid.R0000644000176200001440000000041313204561023020325 0ustar liggesuserscontext("format_rowid") test_that("output test", { expect_pillar_output( xf = rowidformat(3), filename = "rowid-3.txt" ) expect_pillar_output( xf = rowidformat(12, has_title = TRUE, has_star = TRUE), filename = "rowid-star-title-12.txt" ) }) pillar/tests/testthat/test-format_decimal.R0000644000176200001440000000434413204561023020606 0ustar liggesuserscontext("format_decimal") without_color <- function(code) { old <- options(crayon.enabled = FALSE) on.exit(options(old)) code } format_decimal_bw <- function(x, ...) { without_color(format_decimal(x, ...)) } test_that("compute_rhs_digits() works", { x <- c(NA, NaN, Inf, 0, 1, 100, 1e10, 0.001, 1e-20) expect_equal(compute_rhs_digits(x, 3), c(0, 0, 0, 0, 2, 0, 0, 5, 22)) expect_equal(compute_rhs_digits(x, 7), c(0, 0, 0, 0, 6, 3, 0, 9, 26)) }) test_that("compute_exp() returns NA if not relevant", { x <- c(NA, NaN, Inf, 0, 1, 100, 0.001) expect_equal(compute_exp(x), c(NA, NA, NA, NA, 0, 2, -3)) }) test_that("special values appear in LHS", { x <- c(NA, NaN, Inf) f <- format_decimal_bw(x) expect_equal(without_color(format_lhs(f)), format(x)) }) test_that("all-positive values get nothing in neg", { f <- format_decimal_bw(c(0, Inf)) expect_equal(format_neg(f), c("", "")) }) test_that("negative values get - in neg", { f <- format_decimal_bw(c(-Inf, Inf)) expect_equal(format_neg(f), c("-", " ")) }) test_that("trailing zeros pad to sigfigs", { f <- format_decimal_bw(c(1.5, 0.5)) expect_equal(without_color(format_lhs(f)), c("1", "0")) expect_equal(format_rhs(f), c("50 ", "500")) }) test_that("sigfigs split between lhs and rhs", { x <- c(1.50, 10.50, 100.50) f <- format_decimal_bw(x) expect_equal(format_lhs(f), format(trunc(x))) expect_equal(format_rhs(f), c("50", "5 ", " ")) }) test_that("leading 0 added to rhs", { f <- format_decimal_bw(1.01) expect_equal(format_lhs(f), "1") expect_equal(format_rhs(f), "01") }) test_that("values rounded up as expect", { f <- format_decimal_bw(c(18.9, 18.99)) expect_equal(format_lhs(f), c("18", "19")) expect_equal(format_rhs(f), c("9", "0")) }) test_that("values on LHS not rounded", { f <- without_color(format_lhs(format_decimal(123456))) expect_equal(f, "123456") }) test_that("corner cases", { expect_equal(format_lhs(format_decimal_bw(numeric())), character()) expect_equal(format_lhs(format_decimal_bw(numeric(), scientific = TRUE)), character()) }) test_that("output test", { expect_pillar_output((10 ^ (-3:4)) * c(-1, 1), filename = "basic.txt") expect_pillar_output(1.23456 * 10 ^ (-3:3), filename = "decimal-insignif.txt") }) pillar/tests/testthat/test-format_asis.R0000644000176200001440000000030613204561023020141 0ustar liggesuserscontext("format_asis") test_that("output test", { expect_pillar_output(xp = I(1:3), filename = "asis-number.txt") expect_pillar_output(xp = I(list(1, 1:2, 1:3)), filename = "asis-list.txt") }) pillar/tests/testthat/test-format_integer.R0000644000176200001440000000057413204561023020646 0ustar liggesuserscontext("format_numeric") test_that("integer output will use scientific if necessary", { x <- 10000000L + 1:3 expect_pillar_output(x, width = 6, filename = "integer-06.txt") expect_pillar_output(x, width = 7, filename = "integer-07.txt") expect_pillar_output(x, width = 8, filename = "integer-08.txt") expect_pillar_output(x, width = 9, filename = "integer-09.txt") }) pillar/tests/testthat/test-format_logical.R0000644000176200001440000000017213204561023020615 0ustar liggesuserscontext("format_logical") test_that("output test", { expect_pillar_output(c(TRUE, FALSE), filename = "logical.txt") }) pillar/tests/testthat/test-ticks.R0000644000176200001440000000143113204561027016753 0ustar liggesuserscontext("ticks") test_that("title ticks without width restriction", { expect_equal(format_title("proper_title", Inf), "proper_title") expect_equal(format_title("needs ticks", Inf), "`needs ticks`") expect_equal(format_title("'ticks'", Inf), "`'ticks'`") expect_equal(format_title("embedded\nnewline", Inf), "`embedded\\nnewline`") }) test_that("title ticks and width", { expect_equal(format_title("proper_title", 15), "proper_title") expect_equal(format_title("proper_title", 12), "proper_title") expect_equal(format_title("proper_title", 10), continue("proper_ti")) expect_equal(format_title("a b", 6), "`a b`") expect_equal(format_title("a b", 5), "`a b`") expect_equal(format_title("a b", 4), continue("`a ")) expect_equal(format_title("a b", 3), continue("`a")) }) pillar/tests/testthat/test-format_list.R0000644000176200001440000000052313204561023020156 0ustar liggesuserscontext("format_list") test_that("output test", { expect_pillar_output(xp = as.list(1:3), filename = "list-each.txt") expect_pillar_output(xp = list(1:3, NULL), filename = "list-null.txt") expect_pillar_output(list(1:3), filename = "list-na.txt") expect_pillar_output(xp = list(iris), width = 10, filename = "list-narrow.txt") }) pillar/tests/testthat/test-format_scientific.R0000644000176200001440000000166613204561023021334 0ustar liggesuserscontext("format_scientific") format_scientific_bw <- function(x, ...) { old <- options(crayon.enabled = FALSE) on.exit(options(old)) ret <- pillar_shaft(x, ...) # Hack: Pretend decimal format requires 100 characters ret$dec <- set_width(ret$dec, 100) ret <- set_width(ret, 100) ret <- set_min_width(ret, min(get_min_widths(ret))) format(ret, width = get_min_width(ret)) } test_that("negative values displayed correct", { f <- format_scientific_bw(-0.123, superscript = FALSE) expect_equal(unname(format(f)), "-1.23e-1") }) test_that("exponents correct in presence of NA", { f <- format_scientific_bw(c(NA, 1e-5), superscript = FALSE) expect_equal(unname(format(f)), c("NA ", " 1.00e-5")) }) test_that("output test", { expect_pillar_output(10 ^ c(-9, -6, 3, 9), width = 10, filename = "scientific.txt") expect_pillar_output((10 ^ c(3, 9, 15, 22)) * c(-1, 1), width = 10, filename = "scientific-short-neg.txt") }) pillar/tests/testthat/test-format_multi.R0000644000176200001440000001340013204561027020337 0ustar liggesuserscontext("format_multi") test_that("output test", { x <- list(column_zero_one = 1:3 + 0.23, col_02 = letters[1:3], col_03 = factor(letters[1:3]), col_04 = ordered(letters[1:3])) expect_pillar_output(xf = colonnade(x, width = 4), filename = "multi-04.txt") expect_pillar_output(xf = colonnade(x, width = 5), filename = "multi-05.txt") expect_pillar_output(xf = colonnade(x, width = 6), filename = "multi-06.txt") expect_pillar_output(xf = colonnade(x, width = 7), filename = "multi-07.txt") expect_pillar_output(xf = colonnade(x, width = 8), filename = "multi-08.txt") expect_pillar_output(xf = colonnade(x, width = 9), filename = "multi-09.txt") expect_pillar_output(xf = colonnade(x, width = 10), filename = "multi-10.txt") expect_pillar_output(xf = colonnade(x, width = 11), filename = "multi-11.txt") expect_pillar_output(xf = colonnade(x, width = 12), filename = "multi-12.txt") expect_pillar_output(xf = colonnade(x, width = 13), filename = "multi-13.txt") expect_pillar_output(xf = colonnade(x, width = 14), filename = "multi-14.txt") expect_pillar_output(xf = colonnade(x, width = 15), filename = "multi-15.txt") expect_pillar_output(xf = colonnade(x, width = 16), filename = "multi-16.txt") expect_pillar_output(xf = colonnade(x, width = 17), filename = "multi-17.txt") expect_pillar_output(xf = colonnade(x, width = 18), filename = "multi-18.txt") expect_pillar_output(xf = colonnade(x, width = 19), filename = "multi-19.txt") expect_pillar_output(xf = colonnade(x, width = 20), filename = "multi-20.txt") expect_pillar_output(xf = colonnade(x, width = 21), filename = "multi-21.txt") expect_pillar_output(xf = colonnade(x, width = 22), filename = "multi-22.txt") expect_pillar_output(xf = colonnade(x, width = 23), filename = "multi-23.txt") expect_pillar_output(xf = colonnade(x, width = 24), filename = "multi-24.txt") expect_pillar_output(xf = colonnade(x, width = 25), filename = "multi-25.txt") expect_pillar_output(xf = colonnade(x, width = 26), filename = "multi-26.txt") expect_pillar_output(xf = colonnade(x, width = 27), filename = "multi-27.txt") expect_pillar_output(xf = colonnade(x, width = 28), filename = "multi-28.txt") expect_pillar_output(xf = colonnade(x, width = 29), filename = "multi-29.txt") expect_pillar_output(xf = colonnade(x, width = 30), filename = "multi-30.txt") expect_pillar_output(xf = colonnade(x, width = 31), filename = "multi-31.txt") expect_pillar_output(xf = colonnade(x, width = 32), filename = "multi-32.txt") expect_pillar_output(xf = colonnade(x, width = 33), filename = "multi-33.txt") expect_pillar_output(xf = colonnade(x, width = 34), filename = "multi-34.txt") expect_pillar_output(xf = colonnade(x, width = 35), filename = "multi-35.txt") expect_pillar_output(xf = colonnade(x, width = 36), filename = "multi-36.txt") expect_pillar_output(xf = colonnade(x, width = 37), filename = "multi-37.txt") expect_pillar_output(xf = colonnade(x, width = 38), filename = "multi-38.txt") expect_pillar_output(xf = colonnade(x, width = 39), filename = "multi-39.txt") expect_pillar_output(xf = colonnade(x, width = Inf), filename = "multi-inf.txt") skip_on_os("windows") expect_pillar_output( xf = colonnade( rep(list(paste(letters, collapse = " ")), 4), width = Inf ), filename = "letters-inf.txt" ) expect_pillar_output( xf = new_vertical(extra_cols(squeeze(colonnade(x), width = 10))), filename = "multi-extra-10.txt" ) }) test_that("tests from tibble", { expect_pillar_output( crayon = FALSE, xf = colonnade(mtcars[1:8, ], has_row_id = "*", width = 30), filename = "tibble-mtcars-8-30.txt" ) expect_pillar_output( crayon = FALSE, xf = colonnade(iris[1:5, ], width = 30), filename = "tibble-iris-5-30.txt" ) expect_pillar_output( crayon = FALSE, xf = colonnade(iris[1:3, ], width = 20), filename = "tibble-iris-3-20.txt" ) expect_pillar_output( crayon = FALSE, xf = colonnade(df_all, width = 30), filename = "tibble-all--30.txt" ) expect_pillar_output( crayon = FALSE, xf = colonnade(df_all, width = 300), filename = "tibble-all--300.txt" ) expect_pillar_output( crayon = FALSE, xf = colonnade(df_all, width = 300), output_width = 70L, filename = "tibble-all--300-70.txt" ) expect_pillar_output( crayon = FALSE, xf = colonnade(df_all, width = 300), output_width = 60L, filename = "tibble-all--300-60.txt" ) expect_pillar_output( crayon = FALSE, xf = colonnade(df_all, width = 300), output_width = 50L, filename = "tibble-all--300-50.txt" ) expect_pillar_output( crayon = FALSE, xf = colonnade(df_all, width = 300), output_width = 40L, filename = "tibble-all--300-40.txt" ) expect_pillar_output( crayon = FALSE, xf = colonnade(df_all, width = 300), output_width = 30L, filename = "tibble-all--300-30.txt" ) expect_pillar_output( crayon = FALSE, xf = colonnade(df_all, width = 300), output_width = 20L, filename = "tibble-all--300-20.txt" ) expect_pillar_output( crayon = FALSE, xf = colonnade(list(`\n` = c("\n", '"'), `\r` = factor("\n")), width = 30), filename = "tibble-newline.txt" ) expect_pillar_output( crayon = FALSE, xf = colonnade(list(a = c("", " ", "a ", " a")), width = 30), filename = "tibble-space.txt" ) expect_pillar_output( crayon = FALSE, xf = colonnade(list("mean(x)" = 5, "var(x)" = 3), width = 30), filename = "tibble-non-syntactic.txt" ) }) test_that("empty", { expect_equal( format(colonnade(list(a = character(), b = logical()), width = 30)), structure(character(), class = "pillar_vertical") ) expect_equal( format(colonnade(iris[1:5, character()], width = 30)), structure(character(), class = "pillar_vertical") ) }) pillar/tests/testthat/test-format_date.R0000644000176200001440000000017313204561023020121 0ustar liggesuserscontext("format_date") test_that("output test", { expect_pillar_output(as.Date("2017-07-28"), filename = "date.txt") }) pillar/tests/testthat/test-obj-sum.R0000644000176200001440000000226313204561023017212 0ustar liggesuserscontext("obj_sum") # obj_sum ---------------------------------------------------------------- test_that("shows only first class name for S4", { A <- methods::setClass("A") expect_equal(obj_sum(A), "S4: classGeneratorFunction") }) test_that("shows only first class name for S3", { x <- structure(list(), class = c("a", "b", "c")) expect_equal(obj_sum(x), "S3: a") }) test_that("NULL handled specially", { expect_equal(obj_sum(NULL), "NULL") }) test_that("data frame and tibbles include rows and cols", { expect_equal(obj_sum(mtcars), paste0("data.frame [32 ", mult_sign(), " 11]")) }) test_that("common data vectors treated as atomic", { expect_equal(obj_sum(factor(1:3)), "fctr [3]") expect_equal(obj_sum(ordered(1:3)), "ord [3]") expect_equal(obj_sum(Sys.Date() + 1:3), "date [3]") expect_equal(obj_sum(Sys.time() + 1:3), "dttm [3]") }) test_that("difftime is shown as time", { expect_equal(obj_sum(Sys.time() - Sys.time() + 1:3), "time [3]") }) # type_sum ---------------------------------------------------------------- test_that("less common objects get abbreviations", { expect_equal(type_sum(environment()), "env") expect_equal(type_sum(environment), "fun") }) pillar/tests/testthat/test-format_character.R0000644000176200001440000000476513204561027021157 0ustar liggesuserscontext("format_character") chartype_frame <- function() { chars <- character() desc <- character() chars[1] <- "\u0001\u001f" desc[1] <- "C0 control code" chars[2] <- "\a\b\f\n\r\t" desc[2] <- "Named control code" chars[3] <- "abcdefuvwxyz" desc[3] <- "ASCII" chars[4] <- "\u0080\u009f" desc[4] <- "C1 control code" chars[5] <- paste0("\u00a0\u00a1\u00a2\u00a3\u00a4\u00a5", "\u00fa\u00fb\u00fc\u00fd\u00fe\u00ff") desc[5] <- "Latin-1" chars[6] <- paste0("\u0100\u0101\u0102\u0103\u0104\u0105", "\u0106\u0107\u0108\u0109\u010a\u010b") desc[6] <- "Unicode" chars[7] <- "\uff01\uff02\uff03\uff04\uff05\uff06" desc[7] <- "Unicode wide" chars[8] <- "\ue00\u2029" desc[8] <- "Unicode control" chars[9] <- paste0("x\u00adx\u200bx\u200cx\u200dx\u200ex\u200f", "x\u034fx\ufeffx", intToUtf8(0xE0001), "x", intToUtf8(0xE0020), "x", intToUtf8(0xE01EF), "x") desc[9] <- "Unicode ignorable" chars[10] <- paste0("a\u0300a\u0301a\u0302a\u0303a\u0304a\u0305", "a\u0306a\u0307a\u0308a\u0309a\u030aa\u030b") desc[10] <- "Unicode mark" chars[11] <- paste0(intToUtf8(0x1F600), intToUtf8(0x1F601), intToUtf8(0x1F602), intToUtf8(0x1F603), intToUtf8(0x1F604), intToUtf8(0x1F483)) desc[11] <- "Emoji" chars[12] <- paste0("x", intToUtf8(0x10ffff), "x") desc[12] <- "Unassigned" chars[13] <- "\xfd\xfe\xff" desc[13] <- "Invalid" chars[14] <- "\\" desc[14] <- "Backslash" chars[15] <- '"' desc[15] <- "Quote" Encoding(chars) <- "UTF-8" data.frame(chars, desc, stringsAsFactors = FALSE) } test_that("output test", { expect_pillar_output(letters[1:5], filename = "letters.txt") expect_pillar_output(paste(letters, collapse = ""), filename = "letters-long.txt") expect_pillar_output(paste(letters, collapse = ""), width = 10, filename = "letters-long-10.txt") expect_pillar_output(paste(letters, collapse = ""), width = 3, filename = "letters-long-03.txt") expect_pillar_output("\u6210\u4ea4\u65e5", title = "\u6210\u4ea4", filename = "deal1.txt") expect_pillar_output("\u6210\u4ea4", title = "\u6210\u4ea4\u65e5", filename = "deal2.txt") expect_pillar_output(1L, title = "\u6210\u4ea4\u65e5", filename = "deal3.txt") expect_pillar_output(c("", " ", " a", "a ", "a b"), width = 5, filename = "spaces.txt") skip_on_os("windows") expect_pillar_output(xf = colonnade(chartype_frame()), width = 50, filename = "utf8.txt") }) pillar/tests/testthat/test-format_numeric.R0000644000176200001440000000105713204561023020650 0ustar liggesuserscontext("format_numeric") test_that("same pillar at different widths", { v <- 10 ^ c(-9, -6, 3, 9) x <- pillar(v) expect_equal(get_min_width(x$data), 7) expect_equal(get_width(x$data), 22) expect_pillar_output(xp = v, width = 4, filename = "numeric-04.txt") expect_pillar_output(xp = v, width = 7, filename = "numeric-07.txt") expect_pillar_output(xp = v, width = 10, filename = "numeric-10.txt") expect_pillar_output(xp = v, width = 15, filename = "numeric-15.txt") expect_pillar_output(xp = v, width = 22, filename = "numeric-22.txt") }) pillar/tests/testthat/helper-output.R0000644000176200001440000000352513204561027017504 0ustar liggesusersshow_output_in_terminal <- function() { system2("xterm", c("-e", shQuote("head tests/testthat/out/*; sleep 600"))) } # A data frame with all major types df_all <- list( a = c(1, 2.5, NA), b = c(1:2, NA), c = c(T, F, NA), d = c("a", "b", NA), e = factor(c("a", "b", NA)), f = as.Date("2015-12-09") + c(1:2, NA), g = as.POSIXct("2015-12-09 10:51:34 UTC") + c(1:2, NA), h = as.list(c(1:2, NA)), i = list(list(1, 2:3), list(4:6), list(NA)) ) expect_pillar_output <- function(x = NULL, ..., filename, xp = NULL, xf = NULL, crayon = TRUE, output_width = 80L) { object_quo <- rlang::quo(get_pillar_output_object(x, ..., xp = xp, xf = xf)) expect_pillar_output_utf8(object_quo, filename, output_width) expect_pillar_output_latin1(object_quo, filename, output_width) } expect_pillar_output_utf8 <- function(object_quo, filename, output_width) { if (l10n_info()$`UTF-8`) { expect_known_display( object = !!object_quo, file = file.path("out", filename), crayon = TRUE, width = output_width ) } } expect_pillar_output_latin1 <- function(object_quo, filename, output_width) { if (!l10n_info()$`UTF-8`) { expect_known_display( object = !!object_quo, file = file.path("out-native", filename), crayon = FALSE, width = output_width ) } } get_pillar_output_object <- function(x = NULL, xp = NULL, xf = NULL, ...) { if (is.null(xf)) { if (is.null(xp)) { xp <- add_special(x) } xf <- pillar(xp, ...) } xf } #' `add_special()` is not exported, and used only for initializing default #' values to `expect_pillar_output()`. #' @rdname expect_pillar_output add_special <- function(x) { x <- c(x, NA) if (is.numeric(x) && is.double(x)) { x <- c(x, -Inf, Inf) } x } continue <- function(x) { paste0(x, cli::symbol$continue) } pillar/tests/testthat/out/0000755000176200001440000000000013206765060015353 5ustar liggesuserspillar/tests/testthat/out/tibble-all--300-30.txt0000644000176200001440000000167013206760424020723 0ustar liggesusers a b c d   1 1.00 1 T a 2 2.50 2 F b 3 NA NA NA NA e f   1 a 2015-12-10 2 b 2015-12-11 3 NA NA g   1 2015-12-09 10:51:35 2 2015-12-09 10:51:36 3 NA h i   1   2   3   pillar/tests/testthat/out/letters-inf.txt0000644000176200001440000000104413206760423020345 0ustar liggesusers  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   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   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   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 pillar/tests/testthat/out/numeric-22.txt0000644000176200001440000000032613206760424017777 0ustar liggesusers  0.00000000100 0.00000100 1000 1000000000 pillar/tests/testthat/out/numeric-04.txt0000644000176200001440000000020613206760424017774 0ustar liggesusers  1.00e⁻⁹ 1.00e⁻⁶ 1.00e⁺³ 1.00e⁺⁹ pillar/tests/testthat/out/tibble-all--30.txt0000644000176200001440000000044713206760423020423 0ustar liggesusers a b c d   1 1.00 1 T a 2 2.50 2 F b 3 NA NA NA NA pillar/tests/testthat/out/multi-22.txt0000644000176200001440000000030013206760422017455 0ustar liggesusers column… col_… col_…   1 1.23 a a 2 2.23 b b 3 3.23 c c pillar/tests/testthat/out/letters.txt0000644000176200001440000000012113206760421017564 0ustar liggesusers a b c d e NA pillar/tests/testthat/out/multi-13.txt0000644000176200001440000000017513206760422017467 0ustar liggesusers column_ze…   1 1.23 2 2.23 3 3.23 pillar/tests/testthat/out/list-na.txt0000644000176200001440000000010513206760422017454 0ustar liggesusers    pillar/tests/testthat/out/tibble-all--300-20.txt0000644000176200001440000000106113206760424020714 0ustar liggesusers a b c   1 1.00 1 T 2 2.50 2 F 3 NA NA NA d e   1 a a 2 b b 3 NA NA f   1 2015-12-10 2 2015-12-11 3 NA pillar/tests/testthat/out/multi-27.txt0000644000176200001440000000034413206760423017473 0ustar liggesusers colum… col_… col_… col_…   1 1.23 a a a 2 2.23 b b b 3 3.23 c c c pillar/tests/testthat/out/scientific-short-neg.txt0000644000176200001440000000050513206760424022137 0ustar liggesusers  - 1.00e ³ 1.00e ⁹ - 1.00e¹⁵ 1.00e²² NA   -Inf   Inf   pillar/tests/testthat/out/multi-09.txt0000644000176200001440000000015113206760422017466 0ustar liggesusers colum…   1 1.23 2 2.23 3 3.23 pillar/tests/testthat/out/multi-14.txt0000644000176200001440000000021513206760422017463 0ustar liggesusers colu… col_…   1 1.23 a 2 2.23 b 3 3.23 c pillar/tests/testthat/out/multi-extra-10.txt0000644000176200001440000000017713206760423020610 0ustar liggesuserscol_02  col_03  col_04  pillar/tests/testthat/out/multi-17.txt0000644000176200001440000000023413206760422017467 0ustar liggesusers column_… col_…   1 1.23 a 2 2.23 b 3 3.23 c pillar/tests/testthat/out/multi-30.txt0000644000176200001440000000036313206760423017466 0ustar liggesusers column_z… col_… col_… col_…   1 1.23 a a a 2 2.23 b b b 3 3.23 c c c pillar/tests/testthat/out/escaped.txt0000644000176200001440000000006513206760422017516 0ustar liggesusers "a\nb" pillar/tests/testthat/out/multi-06.txt0000644000176200001440000000000013206760422017454 0ustar liggesuserspillar/tests/testthat/out/multi-18.txt0000644000176200001440000000024113206760422017466 0ustar liggesusers column_z… col_…   1 1.23 a 2 2.23 b 3 3.23 c pillar/tests/testthat/out/integer-07.txt0000644000176200001440000000017513206760422017775 0ustar liggesusers  1.00e⁷ 1.00e⁷ 1.00e⁷ NA   pillar/tests/testthat/out/ordered.txt0000644000176200001440000000012113206760422017527 0ustar liggesusers a b c d e NA pillar/tests/testthat/out/numeric-10.txt0000644000176200001440000000022513206760424017772 0ustar liggesusers  1.00e⁻⁹ 1.00e⁻⁶ 1.00e⁺³ 1.00e⁺⁹ pillar/tests/testthat/out/multi-04.txt0000644000176200001440000000000013206760422017452 0ustar liggesuserspillar/tests/testthat/out/multi-08.txt0000644000176200001440000000014413206760422017467 0ustar liggesusers colu…   1 1.23 2 2.23 3 3.23 pillar/tests/testthat/out/multi-24.txt0000644000176200001440000000031213206760422017462 0ustar liggesusers column_z… col_… col_…   1 1.23 a a 2 2.23 b b 3 3.23 c c pillar/tests/testthat/out/multi-34.txt0000644000176200001440000000040513206760423017467 0ustar liggesusers column_zero… col_02 col_… col_…   1 1.23 a a a 2 2.23 b b b 3 3.23 c c c pillar/tests/testthat/out/multi-38.txt0000644000176200001440000000042513206760423017475 0ustar liggesusers column_zero_one col_02 col_03 col_…   1 1.23 a a a 2 2.23 b b b 3 3.23 c c c pillar/tests/testthat/out/deal2.txt0000644000176200001440000000012113206760422017072 0ustar liggesusers成交日   成交 NA pillar/tests/testthat/out/list-each.txt0000644000176200001440000000013113206760422017755 0ustar liggesusers     pillar/tests/testthat/out/integer-08.txt0000644000176200001440000000016213206760422017772 0ustar liggesusers  10000001 10000002 10000003 NA pillar/tests/testthat/out/date.txt0000644000176200001440000000011013206760422017016 0ustar liggesusers  2017-07-28 NA pillar/tests/testthat/out/tibble-all--300.txt0000644000176200001440000000150213206760423020474 0ustar liggesusers a b c d e f g h   1 1.00 1 T a a 2015-12-10 2015-12-09 10:51:35  2 2.50 2 F b b 2015-12-11 2015-12-09 10:51:36  3 NA NA NA NA NA NA NA  i   1  2  3  pillar/tests/testthat/out/multi-05.txt0000644000176200001440000000000013206760422017453 0ustar liggesuserspillar/tests/testthat/out/multi-36.txt0000644000176200001440000000041713206760423017474 0ustar liggesusers column_zero_one col_… col_… col_…   1 1.23 a a a 2 2.23 b b b 3 3.23 c c c pillar/tests/testthat/out/rowid-3.txt0000644000176200001440000000007113206760424017375 0ustar liggesusers  1 2 3 pillar/tests/testthat/out/multi-12.txt0000644000176200001440000000017013206760422017461 0ustar liggesusers column_z…   1 1.23 2 2.23 3 3.23 pillar/tests/testthat/out/multi-11.txt0000644000176200001440000000016313206760422017462 0ustar liggesusers column_…   1 1.23 2 2.23 3 3.23 pillar/tests/testthat/out/multi-16.txt0000644000176200001440000000022713206760422017470 0ustar liggesusers column… col_…   1 1.23 a 2 2.23 b 3 3.23 c pillar/tests/testthat/out/factor.txt0000644000176200001440000000013013206760422017361 0ustar liggesusers a b c d e NA pillar/tests/testthat/out/list-narrow.txt0000644000176200001440000000006513206760422020373 0ustar liggesusers   "" " " " a" "a " a b NA pillar/tests/testthat/out/tibble-iris-5-30.txt0000644000176200001440000000064713206760423020710 0ustar liggesusers Sepal.… Sepal… Petal… Peta…   1 5.10 3.50 1.40 0.200 2 4.90 3.00 1.40 0.200 3 4.70 3.20 1.30 0.200 4 4.60 3.10 1.50 0.200 5 5.00 3.60 1.40 0.200 pillar/tests/testthat/out/multi-39.txt0000644000176200001440000000043013206760423017472 0ustar liggesusers column_zero_one col_02 col_03 col_04   1 1.23 a a a 2 2.23 b b b 3 3.23 c c c pillar/tests/testthat/out/tibble-non-syntactic.txt0000644000176200001440000000015613206760424022145 0ustar liggesusers `mean(x)` `var(x)`   1 5.00 3.00 pillar/tests/testthat/out/multi-29.txt0000644000176200001440000000035613206760423017500 0ustar liggesusers column_… col_… col_… col_…   1 1.23 a a a 2 2.23 b b b 3 3.23 c c c pillar/tests/testthat/out/multi-21.txt0000644000176200001440000000027313206760422017465 0ustar liggesusers colum… col_… col_…   1 1.23 a a 2 2.23 b b 3 3.23 c c pillar/tests/testthat/out/asis-list.txt0000644000176200001440000000013113206760421020013 0ustar liggesusers    pillar/tests/testthat/out/logical.txt0000644000176200001440000000007713206760422017527 0ustar liggesusers T F NA pillar/tests/testthat/out/letters-long-03.txt0000644000176200001440000000007313206760422020750 0ustar liggesusers abcd… NA pillar/tests/testthat/out/multi-inf.txt0000644000176200001440000000043013206760423020013 0ustar liggesusers column_zero_one col_02 col_03 col_04   1 1.23 a a a 2 2.23 b b b 3 3.23 c c c pillar/tests/testthat/out/numeric-15.txt0000644000176200001440000000025613206760424020003 0ustar liggesusers  1.00e⁻⁹ 1.00e⁻⁶ 1.00e⁺³ 1.00e⁺⁹ pillar/tests/testthat/out/multi-10.txt0000644000176200001440000000015613206760422017463 0ustar liggesusers column…   1 1.23 2 2.23 3 3.23 pillar/tests/testthat/out/multi-33.txt0000644000176200001440000000040013206760423017461 0ustar liggesusers column_zer… col_02 col_… col_…   1 1.23 a a a 2 2.23 b b b 3 3.23 c c c pillar/tests/testthat/out/integer-06.txt0000644000176200001440000000017513206760422017774 0ustar liggesusers  1.00e⁷ 1.00e⁷ 1.00e⁷ NA   pillar/tests/testthat/out/tibble-all--300-70.txt0000644000176200001440000000150213206760423020720 0ustar liggesusers a b c d e f g   1 1.00 1 T a a 2015-12-10 2015-12-09 10:51:35 2 2.50 2 F b b 2015-12-11 2015-12-09 10:51:36 3 NA NA NA NA NA NA NA h i   1   2   3   pillar/tests/testthat/out/tibble-all--300-40.txt0000644000176200001440000000157513206760424020730 0ustar liggesusers a b c d e   1 1.00 1 T a a 2 2.50 2 F b b 3 NA NA NA NA NA f g   1 2015-12-10 2015-12-09 10:51:35 2 2015-12-11 2015-12-09 10:51:36 3 NA NA h i   1   2   3   pillar/tests/testthat/out/title-short.txt0000644000176200001440000000037113206760424020372 0ustar liggesusers short   10.0 100 1000 10000 100000 1000000 NA - Inf Inf pillar/tests/testthat/out/multi-07.txt0000644000176200001440000000000013206760422017455 0ustar liggesuserspillar/tests/testthat/out/tibble-iris-3-20.txt0000644000176200001440000000026613206760423020702 0ustar liggesusers Sepa… Sepa… Peta…   1 5.10 3.50 1.40 2 4.90 3.00 1.40 3 4.70 3.20 1.30 pillar/tests/testthat/out/multi-19.txt0000644000176200001440000000024613206760422017474 0ustar liggesusers column_ze… col_…   1 1.23 a 2 2.23 b 3 3.23 c pillar/tests/testthat/out/tibble-space.txt0000644000176200001440000000030413206760424020442 0ustar liggesusers a   1 "" 2 " " 3 "a " 4 " a" pillar/tests/testthat/out/title-crayon.txt0000644000176200001440000000037113206760424020526 0ustar liggesusers crayon   10.0 100 1000 10000 100000 1000000 NA - Inf Inf pillar/tests/testthat/out/multi-37.txt0000644000176200001440000000042213206760423017471 0ustar liggesusers column_zero_one col_02 col_… col_…   1 1.23 a a a 2 2.23 b b b 3 3.23 c c c pillar/tests/testthat/out/rowid-star-title-12.txt0000644000176200001440000000027713206760424021553 0ustar liggesusers  *  1  2  3  4  5  6  7  8  9 10 11 12 pillar/tests/testthat/out/basic.txt0000644000176200001440000000061313206760422017172 0ustar liggesusers  - 0.00100 0.0100 - 0.100 1.00 - 10.0 100 - 1000 10000 NA - Inf Inf pillar/tests/testthat/out/tibble-newline.txt0000644000176200001440000000030513206760424021011 0ustar liggesusers `\n` `\r`   1 "\n" "\n" 2 "\"" "\n" pillar/tests/testthat/out/multi-31.txt0000644000176200001440000000036613206760423017472 0ustar liggesusers column_z… col_02 col_… col_…   1 1.23 a a a 2 2.23 b b b 3 3.23 c c c pillar/tests/testthat/out/multi-35.txt0000644000176200001440000000041013206760423017464 0ustar liggesusers column_zero… col_02 col_03 col_…   1 1.23 a a a 2 2.23 b b b 3 3.23 c c c pillar/tests/testthat/out/multi-23.txt0000644000176200001440000000030513206760422017463 0ustar liggesusers column_… col_… col_…   1 1.23 a a 2 2.23 b b 3 3.23 c c pillar/tests/testthat/out/list-null.txt0000644000176200001440000000010513206760422020030 0ustar liggesusers    pillar/tests/testthat/out/multi-26.txt0000644000176200001440000000033713206760422017473 0ustar liggesusers colu… col_… col_… col_…   1 1.23 a a a 2 2.23 b b b 3 3.23 c c c pillar/tests/testthat/out/tibble-mtcars-8-30.txt0000644000176200001440000000062513206760423021232 0ustar liggesusers mpg cyl disp hp *  1 21.0 6.00 160 110 2 21.0 6.00 160 110 3 22.8 4.00 108 93.0 4 21.4 6.00 258 110 5 18.7 8.00 360 175 6 18.1 6.00 225 105 7 14.3 8.00 360 245 8 24.4 4.00 147 62.0 pillar/tests/testthat/out/time-posix.txt0000644000176200001440000000015513206760424020212 0ustar liggesusers  2017-07-28 18:04:35 NA pillar/tests/testthat/out/deal3.txt0000644000176200001440000000011713206760422017100 0ustar liggesusers成交日   1 NA pillar/tests/testthat/out/utf8.txt0000644000176200001440000000206413206760422017001 0ustar liggesusers chars desc    1 "\u0001\u001f" C0 control code  2 "\a\b\f\n\r\t" Named control code  3 abcdefuvwxyz ASCII  4 "\u0080\u009f" C1 control code  5  ¡¢£¤¥úûüýþÿ Latin-1  6 ĀāĂ㥹ĆćĈĉĊċ Unicode  7 !"#$%& Unicode wide  8 "\u0e00\u2029" Unicode control  9 x­x​x‌x‍x‎x‏x͏xx󠀁x󠀠x󠇯x Unicode ignorable 10 àáâãāa̅ăȧäảåa̋ Unicode mark 11 😀😁😂😃😄💃 Emoji 12 "x\U0010ffffx" Unassigned 13 "\xfd\xfe\xff" Invalid 14 "\\" Backslash 15 "\"" Quote pillar/tests/testthat/out/time.txt0000644000176200001440000000015513206760424017052 0ustar liggesusers  2017-07-28 18:04:35 NA pillar/tests/testthat/out/asis-number.txt0000644000176200001440000000006713206760421020340 0ustar liggesusers 1 2 3 pillar/tests/testthat/out/list-one.txt0000644000176200001440000000006613204561023017637 0ustar liggesusers   pillar/tests/testthat/out/tibble-all--300-60.txt0000644000176200001440000000150213206760423020717 0ustar liggesusers a b c d e f   1 1.00 1 T a a 2015-12-10 2 2.50 2 F b b 2015-12-11 3 NA NA NA NA NA NA g h i   1 2015-12-09 10:51:35   2 2015-12-09 10:51:36   3 NA   pillar/tests/testthat/out/multi-32.txt0000644000176200001440000000037313206760423017471 0ustar liggesusers column_ze… col_02 col_… col_…   1 1.23 a a a 2 2.23 b b b 3 3.23 c c c pillar/tests/testthat/out/tibble-all--300-50.txt0000644000176200001440000000150213206760423020716 0ustar liggesusers a b c d e f   1 1.00 1 T a a 2015-12-10 2 2.50 2 F b b 2015-12-11 3 NA NA NA NA NA NA g h i   1 2015-12-09 10:51:35   2 2015-12-09 10:51:36   3 NA   pillar/tests/testthat/out/multi-15.txt0000644000176200001440000000022213206760422017462 0ustar liggesusers colum… col_…   1 1.23 a 2 2.23 b 3 3.23 c pillar/tests/testthat/out/letters-long.txt0000644000176200001440000000017013206760421020525 0ustar liggesusers  abcdefghijklmnopqrstuvwxyz NA pillar/tests/testthat/out/title-too-long.txt0000644000176200001440000000045313206760424020772 0ustar liggesusersmuch_too…   1.00e¹ 1.00e² 1.00e³ 1.00e⁴ 1.00e⁵ 1.00e⁶ NA   -Inf   Inf   pillar/tests/testthat/out/multi-28.txt0000644000176200001440000000035113206760423017472 0ustar liggesusers column… col_… col_… col_…   1 1.23 a a a 2 2.23 b b b 3 3.23 c c c pillar/tests/testthat/out/integer-09.txt0000644000176200001440000000016713206760422020000 0ustar liggesusers  10000001 10000002 10000003 NA pillar/tests/testthat/out/scientific.txt0000644000176200001440000000042013206760424020227 0ustar liggesusers  1.00e⁻⁹ 1.00e⁻⁶ 1.00e⁺³ 1.00e⁺⁹ NA   -Inf   Inf   pillar/tests/testthat/out/multi-20.txt0000644000176200001440000000026613206760422017466 0ustar liggesusers colu… col_… col_…   1 1.23 a a 2 2.23 b b 3 3.23 c c pillar/tests/testthat/out/deal1.txt0000644000176200001440000000012113206760422017071 0ustar liggesusers成交   成交日 NA pillar/tests/testthat/out/letters-long-10.txt0000644000176200001440000000011213206760421020737 0ustar liggesusers  abcdefghi… NA pillar/tests/testthat/out/numeric-07.txt0000644000176200001440000000020613206760424017777 0ustar liggesusers  1.00e⁻⁹ 1.00e⁻⁶ 1.00e⁺³ 1.00e⁺⁹ pillar/tests/testthat/out/decimal-insignif.txt0000644000176200001440000000045513206760422021317 0ustar liggesusers  0.00123 0.0123 0.123 1.23 12.3 123 1235 NA - Inf Inf pillar/tests/testthat/out/title-none.txt0000644000176200001440000000034513206760424020173 0ustar liggesusers  10.0 100 1000 10000 100000 1000000 NA - Inf Inf pillar/tests/testthat/out/multi-25.txt0000644000176200001440000000031713206760422017470 0ustar liggesusers column_ze… col_… col_…   1 1.23 a a 2 2.23 b b 3 3.23 c c pillar/tests/testthat/out/title-longer.txt0000644000176200001440000000044513206760424020523 0ustar liggesuserssomewhat_wider   10.0 100 1000 10000 100000 1000000 NA - Inf Inf pillar/tests/testthat/test-format_time.R0000644000176200001440000000035213204561023020141 0ustar liggesuserscontext("format_time") test_that("output test", { expect_pillar_output(as.POSIXct("2017-07-28 18:04:35 +0200"), filename = "time.txt") expect_pillar_output(as.POSIXlt("2017-07-28 18:04:35 +0200"), filename = "time-posix.txt") }) pillar/NAMESPACE0000644000176200001440000000341513204561023012753 0ustar liggesusers# Generated by roxygen2: do not edit by hand S3method(extra_cols,squeezed_colonnade) S3method(format,colonnade) S3method(format,pillar) S3method(format,pillar_shaft) S3method(format,pillar_shaft_decimal) S3method(format,pillar_shaft_simple) S3method(format,pillar_title) S3method(format,pillar_type) S3method(format,rif_data) S3method(format,rif_title) S3method(format,rif_type) S3method(format,squeezed_colonnade) S3method(is_vector_s3,Date) S3method(is_vector_s3,POSIXct) S3method(is_vector_s3,data.frame) S3method(is_vector_s3,default) S3method(is_vector_s3,difftime) S3method(is_vector_s3,factor) S3method(is_vector_s3,ordered) S3method(obj_sum,AsIs) S3method(obj_sum,POSIXlt) S3method(obj_sum,default) S3method(obj_sum,list) S3method(pillar_shaft,AsIs) S3method(pillar_shaft,Date) S3method(pillar_shaft,POSIXt) S3method(pillar_shaft,character) S3method(pillar_shaft,default) S3method(pillar_shaft,list) S3method(pillar_shaft,logical) S3method(pillar_shaft,numeric) S3method(print,colonnade) S3method(print,pillar) S3method(print,pillar_ornament) S3method(print,pillar_shaft) S3method(print,pillar_vertical) S3method(print,rif_data) S3method(print,spark) S3method(print,squeezed_colonnade) S3method(type_sum,AsIs) S3method(type_sum,Date) S3method(type_sum,POSIXct) S3method(type_sum,data.frame) S3method(type_sum,default) S3method(type_sum,difftime) S3method(type_sum,factor) S3method(type_sum,ordered) export(colonnade) export(dim_desc) export(expect_known_display) export(extra_cols) export(get_extent) export(get_max_extent) export(is_vector_s3) export(new_ornament) export(new_pillar_shaft) export(new_pillar_shaft_simple) export(obj_sum) export(pillar) export(pillar_shaft) export(squeeze) export(style_na) export(style_neg) export(style_num) export(style_subtle) export(type_sum) import(rlang) pillar/NEWS.md0000644000176200001440000000225713206757773012662 0ustar liggesusers## pillar 1.0.1 (2017-11-27) - Work around failing CRAN tests on Windows. ## pillar 1.0.0 (2017-11-16) Initial release. ### User functions pillar(x, title = NULL, width = NULL, ...) colonnade(x, has_row_id = TRUE, width = NULL, ...) squeeze(x, width = NULL, ...) ### Functions for implementers of data types new_pillar_shaft_simple(formatted, ..., width = NULL, align = "left", min_width = NULL, na_indent = 0L) new_pillar_shaft(x, ..., width, min_width = width, subclass) new_ornament(x, width = NULL, align = NULL) get_extent(x) get_max_extent(x) ### Utilities dim_desc(x) style_na(x) style_neg(x) style_num(x, negative, significant = rep_along(x, TRUE)) style_subtle(x) ### Testing helper expect_known_display(object, file, ..., width = 80L, crayon = TRUE) ### Own S3 methods pillar_shaft(x, ...) # AsIs, Date, POSIXt, character, default, list, logical, numeric type_sum(x) # AsIs, Date, POSIXct, data.frame, default, difftime, factor, ordered is_vector_s3(x) # Date, POSIXct, data.frame, default, difftime, factor, ordered obj_sum(x) # AsIs, POSIXlt, default, list extra_cols(x, ...) # squeezed_colonnade pillar/R/0000755000176200001440000000000013204561027011736 5ustar liggesuserspillar/R/strrep.R0000644000176200001440000000032313204561023013372 0ustar liggesusersif (getRversion() < "3.3.0") { strrep <- function(x, times) { map_chr( times, function(n) { if (is.na(n)) NA_character_ else paste(rep(x, n), collapse = "") } ) } } pillar/R/utils.R0000644000176200001440000000223013204561023013212 0ustar liggesuserscat_line <- function(...) { cat(..., "\n", sep = "") } str_trunc <- function(x, width) { if (is.infinite(width)) return(x) str_width <- utf8::utf8_width(crayon::strip_style(x), encode = FALSE) too_wide <- which(!is.na(x) & str_width > width) x[too_wide] <- paste0(crayon::col_substr(x[too_wide], 1, width - 1), get_ellipsis()) x } check_sigfig <- function(x) { stopifnot(is.numeric(x), length(x) == 1) x <- as.integer(x) if (x < 1L) { stop("Must show at least one significant figure", call. = FALSE) } x } ruler <- function(width = getOption("width")) { x <- seq_len(width) y <- rep("-", length(x)) y[x %% 10 == 0] <- as.character((x[x %% 10 == 0] %/% 10) %% 10) y[x %% 5 == 0] <- "+" cat(y, "\n", sep = "") cat(x %% 10, "\n", sep = "") } slice <- function(df, index) { df[index, , drop = FALSE] } get_ellipsis <- function() { cli::symbol$continue } is_latex_output <- function() { if (!("knitr" %in% loadedNamespaces())) return(FALSE) get("is_latex_output", asNamespace("knitr"))() } remove_as_is_class <- function(x) { if (all(class(x) == "AsIs")) return(unclass(x)) class(x) <- setdiff(class(x), "AsIs") x } pillar/R/tick.R0000644000176200001440000000057113204561023013012 0ustar liggesusersformat_title <- function(x, width) { needs_ticks <- !is_syntactic(x) x[needs_ticks] <- tick(x[needs_ticks]) str_trunc(x, width) } is_syntactic <- function(x) { ret <- make.names(x) == x ret[is.na(x)] <- FALSE ret } is_ambiguous_string <- function(x) { grepl("^$|^ | $|\\\\|\"", x) } tick <- function(x) { x[is.na(x)] <- "NA" encodeString(x, quote = "`") } pillar/R/dim.R0000644000176200001440000000157413204561023012635 0ustar liggesusers#' Format dimensions #' #' Multi-dimensional objects are formatted as `a x b x ...`, for vectors the #' length is returned. #' #' @param x The object to format the dimensions for #' #' @export #' @examples #' dim_desc(1:10) #' dim_desc(Titanic) dim_desc <- function(x) { dim <- dim(x) %||% length(x) format_dim <- map_chr(dim, big_mark) format_dim[is.na(dim)] <- "??" paste0(format_dim, collapse = spaces_around(mult_sign())) } size_sum <- function(x) { if (!is_vector_s3(x)) return("") paste0(" [", dim_desc(x), "]" ) } mult_sign <- function() { cli::symbol$times } spaces_around <- function(x) { paste0(" ", x, " ") } # function for the thousand separator, # returns "," unless it's used for the decimal point, in which case returns "." big_mark <- function(x, ...) { mark <- if (identical(getOption("OutDec"), ",")) "." else "," formatC(x, big.mark = mark, ...) } pillar/R/pillar.R0000644000176200001440000000564113204561023013346 0ustar liggesusers#' Format a vector suitable for tabular display #' #' `pillar()` formats a vector using one row for a title (if given), #' one row for the type, and `length(x)` rows for the data. #' #' @param x A vector to format #' @param title An optional title for the column #' @param width Default width, optional #' @param ... Other arguments passed to methods #' @export #' @examples #' x <- 123456789 * (10 ^ c(-1, -3, -5, NA, -8, -10)) #' pillar(x) #' pillar(-x) #' pillar(runif(10)) #' pillar(rcauchy(20)) #' #' # Special values are highlighted #' pillar(c(runif(5), NA, NaN, Inf, -Inf)) #' #' # Very wide ranges will be displayed in scientific format #' pillar(c(1e10, 1e-10), width = 20) #' pillar(c(1e10, 1e-10)) #' #' x <- c(FALSE, NA, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE) #' pillar(x) #' #' x <- c("This is string is rather long", NA, "?", "Short") #' pillar(x) #' pillar(x, width = 30) #' pillar(x, width = 5) #' #' date <- as.Date("2017-05-15") #' pillar(date + c(1, NA, 3:5)) #' pillar(as.POSIXct(date) + c(30, NA, 600, 3600, 86400)) pillar <- function(x, title = NULL, width = NULL, ...) { title <- pillar_title(title, ...) type <- pillar_type(x, ...) data <- pillar_shaft(x, ...) ret <- structure( list(title = title, type = type, data = data), class = "pillar" ) ret <- set_width(ret, width) ret } rowidformat <- function(n, has_title_row = FALSE, has_star = FALSE, ...) { title <- rif_title(has_title_row, ...) type <- rif_type(has_star, ...) data <- rif_data(n, ...) ret <- structure( list(title = title, type = type, data = data), class = "pillar" ) ret } #' @export format.pillar <- function(x, width = NULL, ...) { width <- pillar_get_width(x, width) out <- pillar_format_parts(x, width) fmt <- c(out$title_format, style_type_header(out$type_format), out$data_format) new_vertical(fmt) } #' @export print.pillar <- function(x, ...) { print(format(x, ...)) } pillar_get_width <- function(x, width) { if (is.null(width)) { width <- get_width(x) } if (is.null(width)) { widths <- get_widths(x) width <- max(widths) } min_widths <- max(get_min_widths(x)) if (width < min_widths) width <- min_widths width } pillar_format_parts <- function(x, width, ...) { title_format <- format(x$title, width = width, ...) type_format <- format(x$type, width = width, ...) data_format <- format(x$data, width = width, ...) align <- attr(data_format, "align") title_format <- align(title_format, width = width, align = align) type_format <- align(type_format, width = width, align = align) data_format <- align(data_format, width = width, align = align) list( title_format = title_format, type_format = type_format, data_format = data_format ) } pillar_format_abbrev <- function(x, ...) { title_format <- format(x$title, width = Inf, ...) type_format <- style_type(format(x$type, width = Inf, ...)) paste0(title_format, "\u00a0", type_format) } pillar/R/scientific.R0000644000176200001440000000254513204561027014207 0ustar liggesusers# Format numbers in scientific notation # # Uses colour, careful alignment, and superscripts to display numbers # in scientific notation. # # @seealso [format_decimal()] # @inheritParams format_decimal # @param superscript If `TRUE`, will use superscript numbers in exponent. # @examples # format_scientific(1.5:3.5) # format_scientific(1e9) format_scientific <- function(x, sigfig = 3, superscript = TRUE) { split_decimal(x, sigfig, scientific = TRUE, superscript = superscript) } format_exp <- function(x) { supernum(x$exp, superscript = x$superscript) } supernum <- function(x, superscript = TRUE) { stopifnot(is.integer(x)) num <- !is.na(x) if (!any(num)) return(rep_along(x, "")) neg <- num & x < 0 if (any(neg)) { if (superscript) { neg_chr <- ifelse(neg, cli::symbol$sup_minus, cli::symbol$sup_plus) } else { neg_chr <- ifelse(neg, "-", "+") } neg_chr[!num] <- " " } else { neg_chr <- rep("", length(x)) } if (superscript) { digits <- vapply(abs(x), supernum1, character(1)) } else { digits <- as.character(abs(x)) } digits[!num] <- "" exp <- paste0(neg_chr, format(digits, justify = "right")) paste0(style_subtle(ifelse(num, "e", " ")), style_num(exp, neg)) } supernum1 <- function(x) { chars <- strsplit(as.character(x), "")[[1]] paste0(cli::symbol[paste0("sup_", chars)], collapse = "") } pillar/R/sigfig.R0000644000176200001440000001215513204561027013335 0ustar liggesusers# Format numbers in decimal notation # # This formatting system is designed to make it as easy as possible to # compare columns of numbers. Significant digits are coloured black or red # (for positive and negative numbers) and non-significant digits are coloured # in paler gray. # # @return A list with at least the following elements: # * `neg`: negative sign or space, `TRUE` if needed # * `lhs`: whole number # * `dec`: decimal point, `TRUE` if needed # * `rhs`: remainder of number # # @param x A numeric vector # @param sigfig Number of significant figures to display. # @param ... Ignored # @seealso [format_scientific()] # @examples # format_decimal(1.5:3.5) # format_decimal(1e9) format_decimal <- function(x, sigfig = 3, ...) { split_decimal(x, sigfig) } split_decimal <- function(x, sigfig, scientific = FALSE, superscript = FALSE) { stopifnot(is.numeric(x)) sigfig <- check_sigfig(sigfig) abs_x <- abs(x) num <- is.finite(x) # Do we need negative signs? neg <- !is.na(x) & x < 0 # Compute exponent and mantissa exp <- compute_exp(abs_x) if (scientific) { mnt <- ifelse(num & abs_x != 0, abs_x * 10 ^ (-exp), abs_x) round_x <- safe_signif(mnt, sigfig) rhs_digits <- ifelse(num & abs_x != 0, sigfig - 1, 0) exp_display <- exp } else { round_x <- safe_signif(abs_x, pmax(sigfig, exp + 1, na.rm = TRUE)) rhs_digits <- compute_rhs_digits(abs_x, sigfig) exp_display <- rep_along(x, NA_integer_) } lhs <- trunc(round_x) rhs <- round_x - lhs ret <- list( sigfig = sigfig, num = num, neg = neg, lhs = lhs, lhs_zero = (lhs == 0), rhs = rhs, rhs_digits = rhs_digits, dec = rhs_digits > 0, exp = exp_display, superscript = superscript ) set_width(ret, get_max_extent(assemble_decimal(ret))) } safe_signif <- function(x, digits) { if (length(x) == 0L) return(numeric()) signif(x, digits) } compute_rhs_digits <- function(x, sigfig) { # If already bigger than sigfig, can round to zero. # Otherwise ensure we have sigfig digits shown exp <- compute_exp(x) exp[is.na(exp)] <- Inf if (is.integer(x)) { digits <- 0 } else { digits <- ifelse(exp > sigfig, 0, sigfig - exp - ifelse(exp <= 0, 1, 0)) } rhs_digits <- pmax(digits - pmax(exp, 0), 0) rhs_digits } compute_exp <- function(x) { ret <- rep_along(x, NA_integer_) nonzero <- which(x != 0 & is.finite(x)) ret[nonzero] <- as.integer(floor(log10(x[nonzero]))) ret } format_neg <- function(s) { neg <- s$neg if (any(neg)) { neg_col <- ifelse(neg, "-", " ") } else { neg_col <- rep_along(neg, "") } neg_col } format_lhs <- function(s) { neg <- s$neg num <- s$num lhs_zero <- s$lhs_zero lhs_str <- sprintf("%.0f", s$lhs) lhs_width <- get_max_extent(lhs_str) lhs_sig <- crayon::col_substr(lhs_str, 1, s$sigfig) lhs_non <- crayon::col_substr(lhs_str, s$sigfig + 1, get_extent(lhs_str)) # as.character() to support corner case of length zero lhs_col <- as.character(ifelse(num, paste0( style_num(lhs_sig, neg, !lhs_zero), style_subtle(lhs_non) ), style_na(lhs_str) )) lhs_col <- align(lhs_col, width = lhs_width, align = "right") lhs_col } format_dec <- function(s) { neg <- s$neg dec <- s$dec lhs_zero <- s$lhs_zero # Decimal column if (any(dec)) { dec_col <- ifelse(dec, style_num(".", neg, !lhs_zero), " ") } else { dec_col <- rep_along(neg, "") } dec_col } format_rhs <- function(s) { neg <- s$neg dec <- s$dec lhs_zero <- s$lhs_zero rhs_num <- s$rhs_num rhs_digits <- s$rhs_digits # Digits on RHS of . rhs_num <- as.character(abs(round(s$rhs * 10 ^ s$rhs_digits))) rhs_zero <- strrep("0", pmax(0, rhs_digits - get_extent(rhs_num))) rhs_col <- ifelse(dec, paste0( style_num(rhs_zero, neg, !lhs_zero), style_num(rhs_num, neg) ), "" ) # ensure all same width rhs_col <- align(rhs_col, max(rhs_digits, 0L, na.rm = TRUE), "left") rhs_col } #' @export #' @param negative,significant Logical vector the same length as `x` that #' indicate if the values are negative and significant, respectively #' @rdname style_subtle #' @examples #' style_num( #' c("123", "456"), #' negative = c(TRUE, FALSE) #' ) #' style_num( #' c("123", "456"), #' negative = c(TRUE, FALSE), #' significant = c(FALSE, FALSE) #' ) style_num <- function(x, negative, significant = rep_along(x, TRUE)) { ifelse(significant, ifelse(negative, style_neg(x), x), style_subtle(x)) } assemble_decimal <- function(x) { neg <- format_neg(x) lhs <- format_lhs(x) dec <- format_dec(x) rhs <- format_rhs(x) exp <- format_exp(x) paste0(neg, lhs, dec, rhs, exp) } #' @export format.pillar_shaft_decimal <- function(x, width, ...) { if (length(x$dec$num) == 0L) return(character()) if (width < get_min_width(x)) { stop( "Need at least width ", get_min_width(x), " requested ", width, ".", call = FALSE ) } if (width >= get_width(x$dec)) { row <- assemble_decimal(x$dec) } else { row <- assemble_decimal(x$sci) } used_width <- get_max_extent(row) row <- paste0(strrep(" ", width - used_width), row) new_ornament(row, width = width, align = "right") } pillar/R/spark-bar.R0000644000176200001440000000242213204561027013743 0ustar liggesusers# Draw a sparkline bar graph with unicode block characters # # Rendered using [block elements](https://en.wikipedia.org/wiki/Block_Elements). # In most common fixed width fonts these are rendered wider than regular # characters which means they are not suitable if you need precise alignment. # # @param x A numeric vector between 0 and 1 # @param safe Nominally there are 8 block elements from 1/8 height to full # height (8/8). However, the half-height and full-height blocks appear # to be rendered inconsistently (possibly due to font substitution). # @examples # \dontrun{ # x <- seq(0, 1, length = 6) # spark_bar(x) # spark_bar(sample(x)) # # # This might work if you're lucky # spark_bar(seq(0, 1, length = 8), safe = FALSE) # # spark_bar(c(0, NA, 0.5, NA, 1)) # } spark_bar <- function(x, safe = TRUE) { stopifnot(is.numeric(x)) bars <- vapply(0x2581:0x2588, intToUtf8, character(1)) if (safe) { bars <- bars[-c(4, 8)] } factor <- cut( x, breaks = seq(0, 1, length = length(bars) + 1), labels = bars, include.lowest = TRUE ) chars <- as.character(factor) chars[is.na(chars)] <- style_spark_na(bars[length(bars)]) structure(paste0(chars, collapse = ""), class = "spark") } #' @export print.spark <- function(x, ...) { cat(x, "\n", sep = "") } pillar/R/title.R0000644000176200001440000000102013204561027013173 0ustar liggesuserspillar_title <- function(title, ...) { if (is.null(title)) { width <- 0L } else { width <- get_extent(format_title(title, width = Inf)) stopifnot(!is.na(width)) } ret <- structure( list( title = title ), class = "pillar_title" ) ret <- set_width(ret, width) ret <- set_min_width(ret, 3L) ret } #' @export format.pillar_title <- function(x, width, ...) { title <- x$title if (is.null(title)) return(character()) title <- format_title(title, width) crayon::bold(title) } pillar/R/styles.R0000644000176200001440000000225013204561027013403 0ustar liggesuserskeep_empty <- function(fun) { function(x) { ret <- rep_along(x, "") update <- which(is.na(x) | x != "") ret[update] <- fun(x[update]) ret } } #' Styling helpers #' #' Functions that allow implementers of formatters for custom data types to #' maintain a consistent style with the default data types. #' #' @param x The character vector to style. #' @export #' @examples #' style_subtle("text") style_subtle <- keep_empty(function(x) { style_grey(0.6, x) }) style_hint <- keep_empty(function(x) { style_grey(0.8, x) }) style_spark_na <- function(x) { crayon::yellow(x) } #' @rdname style_subtle #' @export #' @examples #' style_na("NA") style_na <- function(x) { crayon::bgYellow(crayon::black(x)) } #' @rdname style_subtle #' @export #' @examples #' style_neg("123") style_neg <- keep_empty(function(x) { crayon::red(x) }) style_grey <- function(level, ...) { crayon::style( paste0(...), crayon::make_style(grDevices::grey(level), grey = TRUE) ) } pillar_na <- function(use_brackets_if_no_color = FALSE) { if (use_brackets_if_no_color && !crayon::has_color()) "" else style_na("NA") } style_list <- function(x) { style_subtle(x) } pillar/R/shaft-simple.R0000644000176200001440000000273213204561023014455 0ustar liggesusers#' @include shaft.R #' @description #' `new_pillar_shaft_simple()` provides an implementation of the `pillar_shaft` #' class suitable for output that has a fixed formatting, which will be #' truncated with a continuation character (ellipsis or `~`) if it doesn't fit #' the available width. #' By default, the required width is computed from the natural width of the #' `formatted` argument. #' #' @details #' The `formatted` argument may also contain ANSI escapes to change color #' or other attributes of the text, see [crayon]. #' #' @param formatted An object coercible to [character]. #' @param align Alignment of the column. #' @param na_indent Indention of `NA` values. #' @export #' @rdname new_pillar_shaft new_pillar_shaft_simple <- function(formatted, ..., width = NULL, align = "left", min_width = NULL, na_indent = 0L) { if (is.null(width)) { width <- get_max_extent(as.character(formatted)) } new_pillar_shaft( list(formatted), ..., width = width, min_width = min_width, align = align, na_indent = na_indent, subclass = "pillar_shaft_simple" ) } #' @export format.pillar_shaft_simple <- function(x, width, ...) { align <- attr(x, "align") desired_width <- get_width(x) data <- as.character(x[[1]]) if (width < desired_width) { data <- str_trunc(data, width) } data[is.na(data)] <- paste0(strrep(" ", attr(x, "na_indent")), pillar_na()) new_ornament(data, width = width, align = align) } pillar/R/type.R0000644000176200001440000000141213204561023013034 0ustar liggesusersstyle_type_header <- function(x) { style_type(x) } style_type <- function(x) { crayon::italic(style_subtle(x)) } pillar_type <- function(x, ...) { type <- as_character(type_sum(x) %||% "") if (length(type) == 0L) type <- "" type <- type[[1L]] ret <- structure( list( type = type ), class = "pillar_type" ) ret <- set_width(ret, width = get_extent(type) + 2L) ret <- set_min_width(ret, 5L) ret } #' @export format.pillar_type <- function(x, width = NULL, ...) { if (is.null(width) || width >= get_width(x)) type <- x$type else type <- crayon::col_substr(x$type, 1, width - 2) # Style is applied later on because we want a continuous underline over the # whole width and over all columns in colonnade() paste0("<", type, ">") } pillar/R/spark-line.R0000644000176200001440000000145313204561027014131 0ustar liggesusers# Draw a sparkline line graph with Braille characters. # # @inheritParams spark_bar # @examples # \dontrun{ # x <- seq(0, 1, length = 10) # spark_line(x) # } spark_line <- function(x) { stopifnot(is.numeric(x)) y <- findInterval(x, seq(0, 1, length = 5), all.inside = TRUE) ind <- matrix(y, ncol = 2, byrow = TRUE) ind[, 2] <- ind[, 2] + 4 chars <- apply(ind, 1, braille) structure(paste0(chars, collapse = ""), class = "spark") } #' @export print.spark <- function(x, ...) { cat(x, "\n", sep = "") } # https://en.wikipedia.org/wiki/Braille_Patterns braille <- function(x) { # remap to braille sequence x <- c(7L, 3L, 2L, 1L, 8L, 6L, 5L, 4L)[x] raised <- 1:8 %in% x binary <- raised * 2 ^ (0:7) # offset in hex is 2800 val <- 10240 + sum(raised * 2 ^ (0:7)) intToUtf8(val) } pillar/R/type-sum.R0000644000176200001440000000441113204561023013640 0ustar liggesusers#' Provide a succinct summary of an object #' #' @description #' `type_sum()` gives a brief summary of object type. Objects that commonly #' occur in a data frame should return a string with four or less characters. #' #' @param x an object to summarise. Generally only methods of atomic vectors #' and variants have been implemented. #' #' @export type_sum <- function(x) UseMethod("type_sum") #' @export type_sum.ordered <- function(x) "ord" #' @export type_sum.factor <- function(x) "fctr" #' @export type_sum.POSIXct <- function(x) "dttm" #' @export type_sum.difftime <- function(x) "time" #' @export type_sum.Date <- function(x) "date" #' @export type_sum.data.frame <- function(x) class(x)[[1]] #' @export type_sum.AsIs <- function(x) paste0("I(", type_sum(remove_as_is_class(x)), ")") #' @export type_sum.default <- function(x) { if (!is.object(x)) { switch(typeof(x), logical = "lgl", integer = "int", double = "dbl", character = "chr", complex = "cplx", closure = "fun", environment = "env", typeof(x) ) } else if (!isS4(x)) { paste0("S3: ", class(x)[[1]]) } else { paste0("S4: ", methods::is(x)[[1]]) } } #' @description #' `obj_sum()` also includes the size of the object if `is_vector_s3()` #' is `TRUE`. #' #' @keywords internal #' @examples #' obj_sum(1:10) #' obj_sum(matrix(1:10)) #' obj_sum(Sys.Date()) #' obj_sum(Sys.time()) #' obj_sum(mean) #' @rdname type_sum #' @export obj_sum <- function(x) UseMethod("obj_sum") #' @export obj_sum.default <- function(x) { paste0(type_sum(x), size_sum(x)) } #' @export obj_sum.list <- function(x) { map_chr(x, obj_sum.default) } #' @export obj_sum.POSIXlt <- function(x) { rep("POSIXlt", length(x)) } #' @export obj_sum.AsIs <- function(x) { paste0("I(", obj_sum(remove_as_is_class(x)), ")") } #' @export #' @rdname type_sum is_vector_s3 <- function(x) UseMethod("is_vector_s3") #' @export is_vector_s3.ordered <- function(x) TRUE #' @export is_vector_s3.factor <- function(x) TRUE #' @export is_vector_s3.Date <- function(x) TRUE #' @export is_vector_s3.POSIXct <- function(x) TRUE #' @export is_vector_s3.difftime <- function(x) TRUE #' @export is_vector_s3.data.frame <- function(x) TRUE #' @export is_vector_s3.default <- function(x) !is.object(x) && is_vector(x) pillar/R/width.R0000644000176200001440000000145513204561027013205 0ustar liggesusersget_width <- function(x) { attr(x, "width") } # Set width and minimum width information for an object # # Returns the input with updated `width` or `min_width` attributes. # # @param x Input to which assign a width or minimum width # @param width,min_width The new width set_width <- function(x, width) { if (is.null(width)) return(x) if (is.infinite(width)) { attr(x, "width") <- NA_integer_ } else { attr(x, "width") <- as.integer(width) } x } get_widths <- function(x) { map_int(x, get_width) } get_min_width <- function(x) { attr(x, "min_width") %||% get_width(x) } # @rdname set_width set_min_width <- function(x, min_width) { if (is.null(min_width)) return(x) attr(x, "min_width") <- as.integer(min_width) x } get_min_widths <- function(x) { map_int(x, get_min_width) } pillar/R/extent.R0000644000176200001440000000173613206757361013411 0ustar liggesusers#' Calculate display width #' #' `get_extent()` calculates the display width for each string in a character #' vector. #' #' @param x A character vector. #' @export #' @examples #' get_extent(c("abc", "de")) #' get_extent("\u904b\u6c23") get_extent <- function(x) { x <- crayon::strip_style(x) width <- utf8::utf8_width(x, encode = FALSE) is_na <- which(is.na(width)) width[is_na] <- nchar(x[is_na], type = "width") width } #' @description #' `get_max_extent()` calculates the maximum display width of all strings in a #' character vector, zero for empty vectors. #' @export #' @rdname get_extent #' @examples #' get_max_extent(c("abc", "de")) get_max_extent <- function(x) { max(get_extent(x), 0L, na.rm = TRUE) } align <- function(x, width, align = c("left", "right")) { align <- match.arg(align) extent <- get_extent(x) spaces <- pmax(width - extent, 0L) if (align == "left") { paste0(x, strrep(" ", spaces)) } else { paste0(strrep(" ", spaces), x) } } pillar/R/ornament.R0000644000176200001440000000264713204561027013715 0ustar liggesusers#' Helper to define the contents of a pillar #' #' This function is useful if your data renders differently depending on the #' available width. In this case, implement the [pillar_shaft()] method for your #' class to return a subclass of "pillar_shaft" and have the [format()] method #' for this subclass call `new_ornament()`. See the implementation of #' `pillar_shaft.numeric()` and `format.pillar_shaft_decimal()` for an example. #' #' @param x A character vector with formatting, see [crayon] #' @param width An optional width of the resulting pillar, computed from `x` if #' missing #' @param align Alignment, one of `"left"` or `"right"` #' #' @export #' @examples #' new_ornament(c("abc", "de"), align = "right") new_ornament <- function(x, width = NULL, align = NULL) { if (is.null(width)) width <- get_max_extent(x) ret <- structure( x, align = align, class = "pillar_ornament" ) ret <- set_width(ret, width) ret } #' @export print.pillar_ornament <- function(x, ...) { if (length(x) > 0) { cat_line(paste( align(x, width = get_width(x), align = attr(x, "align")), collapse = "\n" )) } invisible(x) } new_vertical <- function(x, ..., subclass = NULL) { ret <- structure( x, ..., class = c(subclass, "pillar_vertical") ) ret } #' @export print.pillar_vertical <- function(x, ...) { if (length(x) > 0) { cat_line(paste(x, collapse = "\n")) } invisible(x) } pillar/R/compat-purrr.R0000644000176200001440000000723413204561023014516 0ustar liggesusers# nocov start - compat-purrr (last updated: rlang 0.1.9000) # This file serves as a reference for compatibility functions for # purrr. They are not drop-in replacements but allow a similar style # of programming. This is useful in cases where purrr is too heavy a # package to depend on. Please find the most recent version in rlang's # repository. map <- function(.x, .f, ...) { lapply(.x, .f, ...) } map_mold <- function(.x, .f, .mold, ...) { out <- vapply(.x, .f, .mold, ..., USE.NAMES = FALSE) names(out) <- names(.x) out } map_lgl <- function(.x, .f, ...) { map_mold(.x, .f, logical(1), ...) } map_int <- function(.x, .f, ...) { map_mold(.x, .f, integer(1), ...) } map_dbl <- function(.x, .f, ...) { map_mold(.x, .f, double(1), ...) } map_chr <- function(.x, .f, ...) { map_mold(.x, .f, character(1), ...) } map_cpl <- function(.x, .f, ...) { map_mold(.x, .f, complex(1), ...) } pluck <- function(.x, .f) { map(.x, `[[`, .f) } pluck_lgl <- function(.x, .f) { map_lgl(.x, `[[`, .f) } pluck_int <- function(.x, .f) { map_int(.x, `[[`, .f) } pluck_dbl <- function(.x, .f) { map_dbl(.x, `[[`, .f) } pluck_chr <- function(.x, .f) { map_chr(.x, `[[`, .f) } pluck_cpl <- function(.x, .f) { map_cpl(.x, `[[`, .f) } map2 <- function(.x, .y, .f, ...) { Map(.f, .x, .y, ...) } map2_lgl <- function(.x, .y, .f, ...) { as.vector(map2(.x, .y, .f, ...), "logical") } map2_int <- function(.x, .y, .f, ...) { as.vector(map2(.x, .y, .f, ...), "integer") } map2_dbl <- function(.x, .y, .f, ...) { as.vector(map2(.x, .y, .f, ...), "double") } map2_chr <- function(.x, .y, .f, ...) { as.vector(map2(.x, .y, .f, ...), "character") } map2_cpl <- function(.x, .y, .f, ...) { as.vector(map2(.x, .y, .f, ...), "complex") } args_recycle <- function(args) { lengths <- map_int(args, length) n <- max(lengths) stopifnot(all(lengths == 1L | lengths == n)) to_recycle <- lengths == 1L args[to_recycle] <- map(args[to_recycle], function(x) rep.int(x, n)) args } pmap <- function(.l, .f, ...) { args <- args_recycle(.l) do.call("mapply", c( FUN = list(quote(.f)), args, MoreArgs = quote(list(...)), SIMPLIFY = FALSE, USE.NAMES = FALSE )) } probe <- function(.x, .p, ...) { if (is_logical(.p)) { stopifnot(length(.p) == length(.x)) .p } else { map_lgl(.x, .p, ...) } } keep <- function(.x, .f, ...) { .x[probe(.x, .f, ...)] } discard <- function(.x, .p, ...) { sel <- probe(.x, .p, ...) .x[is.na(sel) | !sel] } map_if <- function(.x, .p, .f, ...) { matches <- probe(.x, .p) .x[matches] <- map(.x[matches], .f, ...) .x } compact <- function(.x) { Filter(length, .x) } transpose <- function(.l) { inner_names <- names(.l[[1]]) if (is.null(inner_names)) { fields <- seq_along(.l[[1]]) } else { fields <- set_names(inner_names) } map(fields, function(i) { map(.l, .subset2, i) }) } every <- function(.x, .p, ...) { for (i in seq_along(.x)) { if (!rlang::is_true(.p(.x[[i]], ...))) return(FALSE) } TRUE } some <- function(.x, .p, ...) { for (i in seq_along(.x)) { if (rlang::is_true(.p(.x[[i]], ...))) return(TRUE) } FALSE } negate <- function(.p) { function(...) !.p(...) } reduce <- function(.x, .f, ..., .init) { f <- function(x, y) .f(x, y, ...) Reduce(f, .x, init = .init) } reduce_right <- function(.x, .f, ..., .init) { f <- function(x, y) .f(y, x, ...) Reduce(f, .x, init = .init, right = TRUE) } accumulate <- function(.x, .f, ..., .init) { f <- function(x, y) .f(x, y, ...) Reduce(f, .x, init = .init, accumulate = TRUE) } accumulate_right <- function(.x, .f, ..., .init) { f <- function(x, y) .f(y, x, ...) Reduce(f, .x, init = .init, right = TRUE, accumulate = TRUE) } # nocov end pillar/R/shaft.R0000644000176200001440000001141213204561027013165 0ustar liggesusers#' Constructor for column data #' #' The `new_pillar_shaft()` constructor creates objects of the `"pillar_shaft"` #' class. #' This is a virtual or abstract class, you must specify the `subclass` #' argument. #' By convention, this should be a string that starts with `"pillar_shaft_"`. #' See `vignette("extending", package = "tibble")` for usage examples. #' #' @param x An object #' @param ... Additional attributes #' @param width The maximum column width. #' @param min_width The minimum allowed column width, `width` if omitted. #' @param subclass The name of the subclass. #' @export new_pillar_shaft <- function(x, ..., width, min_width = width, subclass) { stopifnot(is.character(subclass)) stopifnot(length(subclass) > 0) ret <- structure( x, ..., class = c(subclass, "pillar_shaft") ) ret <- set_width(ret, width) ret <- set_min_width(ret, min_width) ret } #' Column data #' #' Internal class for formatting the data for a column. #' `pillar_shaft()` is a coercion method that must be implemented #' for your data type to display it in a tibble. #' #' @param x A vector to format #' @param ... Unused, for extensibility. #' @export #' @examples #' pillar_shaft(1:3) #' pillar_shaft(1.5:3.5) #' pillar_shaft(NA) #' pillar_shaft(c(1:3, NA)) pillar_shaft <- function(x, ...) { UseMethod("pillar_shaft") } #' @param width Width for printing and formatting. #' @export #' @rdname pillar_shaft print.pillar_shaft <- function(x, width = NULL, ...) { #' @description #' This class comes with a default method for [print()] that calls [format()]. #' If `print()` is called without `width` argument, the natural width will be #' used when calling `format()`. #' Usually there's no need to implement this method for your subclass. if (is.null(width)) width <- get_width(x) print(format(x, width = width, ...)) } #' @export #' @rdname pillar_shaft format.pillar_shaft <- function(x, width, ...) { #' @description #' Your subclass must implement `format()`, the default implementation just #' raises an error. #' Your `format()` method can assume a valid value for the `width` argument. stop("Please implement a format() method for class ", class(x)[[1]], call. = FALSE) } # Methods ----------------------------------------------------------------- #' @export #' @rdname pillar_shaft pillar_shaft.logical <- function(x, ...) { out <- rep(NA, length(x)) out[x] <- "T" out[!x] <- "F" new_pillar_shaft_simple(out, width = 1, align = "left") } #' @export #' @rdname pillar_shaft #' @param sigfig Minimum number of significant figures to display. Numbers #' larger than 1 will potentially show more significant figures than this #' but they will be greyed out. pillar_shaft.numeric <- function(x, ..., sigfig = 3) { dec <- format_decimal(x, ..., sigfig = sigfig) sci <- format_scientific(x, ..., sigfig = sigfig) ret <- list(dec = dec, sci = sci) new_pillar_shaft( ret, width = get_width(ret$dec), min_width = min(get_min_widths(ret)), subclass = "pillar_shaft_decimal" ) } #' @export #' @rdname pillar_shaft pillar_shaft.Date <- function(x, ...) { x <- format(x, format = "%Y-%m-%d") new_pillar_shaft_simple(x, width = 10, align = "left") } #' @export #' @rdname pillar_shaft pillar_shaft.POSIXt <- function(x, ...) { date <- format(x, format = "%Y-%m-%d") time <- format(x, format = "%H:%M:%S") datetime <- paste0(date, " " , style_subtle(time)) datetime[is.na(x)] <- NA new_pillar_shaft_simple(datetime, width = 19, align = "left") } #' @export #' @rdname pillar_shaft pillar_shaft.character <- function(x, ...) { x <- utf8::utf8_encode(x) out <- x # Add subtle quotes if necessary needs_quotes <- which(is_ambiguous_string(x)) if (length(needs_quotes) > 0) { quoted <- gsub('"', '\\"', x[needs_quotes], fixed = TRUE) quoted <- paste0(style_subtle('"'), quoted, style_subtle('"')) out[needs_quotes] <- quoted } # Format NA values separately is_na <- which(is.na(x)) if (length(is_na) > 0) { na_contents <- pillar_na(use_brackets_if_no_color = TRUE) out[is_na] <- na_contents } width <- get_max_extent(out) new_pillar_shaft_simple(out, width = width, align = "left", min_width = min(width, 3L)) } #' @export #' @rdname pillar_shaft pillar_shaft.list <- function(x, ...) { out <- paste0("<", obj_sum(x), ">") width <- get_max_extent(out) new_pillar_shaft_simple(style_list(out), width = width, align = "left", min_width = min(width, 3L)) } #' @export #' @rdname pillar_shaft pillar_shaft.AsIs <- function(x, ...) { pillar_shaft(remove_as_is_class(x)) } #' @export #' @rdname pillar_shaft pillar_shaft.default <- function(x, ...) { #' @details #' The default method will currently coerce via [as.character()], #' but you should not rely on this behavior. pillar_shaft(as.character(x), ...) } pillar/R/rowid-type.R0000644000176200001440000000050613204561023014161 0ustar liggesusersstyle_star <- function(x) { style_hint(x) } rif_type <- function(has_star, ...) { star <- if (has_star) "*" else "" ret <- structure( list( star = star ), class = "rif_type" ) ret <- set_width(ret, 1L) ret } #' @export format.rif_type <- function(x, width = NULL, ...) { style_star(x$star) } pillar/R/rowid-data.R0000644000176200001440000000071713204561023014115 0ustar liggesusersstyle_rowid <- function(x) { style_hint(x) } rif_data <- function(n, ...) { ret <- structure( list(n = n), class = "rif_data" ) ret <- set_width(ret, as.integer(floor(log10(max(n, 1))) + 1)) ret } #' @export format.rif_data <- function(x, width, ...) { new_ornament( style_rowid(format(seq_len(x$n), width = width)), width = width, align = "right" ) } #' @export print.rif_data <- function(x, ...) { print(format(x, ...)) } pillar/R/multi.R0000644000176200001440000002640413204561027013221 0ustar liggesusers#' Format multiple vectors in a tabular display #' #' The vectors are formatted to fit horizontally into a user-supplied number of #' characters per row. #' #' @param x A list of vectors to format #' @param has_row_id Include a column indicating row IDs? Pass `"*"` to mark #' the row ID column with a star. #' @param width Default width of the entire output, optional #' @param ... Ignored #' @export #' @examples #' colonnade(list(a = 1:3, b = letters[1:3])) #' #' long_string <- list(paste(letters, collapse = " ")) #' colonnade(long_string, width = 20) #' colonnade(long_string, has_row_id = FALSE, width = 20) #' #' # The width can also be overridden when calling format() or print(): #' print(colonnade(long_string), width = 20) #' #' # If width is larger than getOption("width"), multiple tiers are created: #' colonnade(rep(long_string, 4), width = Inf) colonnade <- function(x, has_row_id = TRUE, width = NULL, ...) { has_title <- is_named(x) if (has_title) { ret <- map2(x, names(x), pillar) } else { ret <- map(x, pillar) } if (!is_false(has_row_id) && length(x) > 0) { rowid <- rowidformat( length(x[[1]]), has_star = identical(has_row_id, "*"), has_title_row = has_title ) } else { rowid <- NULL } zero_height <- length(x) == 0L || length(x[[1]]) == 0L ret <- structure(ret, zero_height = zero_height, rowid = rowid, class = "colonnade") ret <- set_width(ret, width) ret } #' @description #' The `squeeze()` function is called by [format()] and [print()] and usually #' doesn't need to be called manually. #' It returns an object suitable for printing and formatting at a fixed width #' with additional information about omitted columns. #' #' @rdname colonnade #' @export #' @examples #' squeeze(colonnade(long_string), width = 20) squeeze <- function(x, width = NULL, ...) { # Hacky shortcut for zero-height corner case if (attr(x, "zero_height")) { return(new_colonnade_sqeezed(list(), x)) } if (is.null(width)) { width <- get_width(x) } if (is.null(width)) { width <- getOption("width") } rowid <- attr(x, "rowid") if (is.null(rowid)) rowid_width <- 0 else rowid_width <- max(get_widths(rowid)) + 1L col_widths <- colonnade_get_width(x, width, rowid_width) col_widths_show <- split(col_widths, factor(col_widths$tier != 0, levels = c(FALSE, TRUE))) col_widths_shown <- col_widths_show[["TRUE"]] col_widths_tiers <- split(col_widths_shown, col_widths_shown$tier) out <- map(col_widths_tiers, function(tier) { map2(x[tier$id], tier$width, pillar_format_parts) }) if (!is.null(rowid)) { rowid_formatted <- pillar_format_parts(rowid, rowid_width - 1L) out <- map(out, function(x) c(list(rowid_formatted), x)) } col_widths_extra <- col_widths_show[["FALSE"]] new_colonnade_sqeezed(out, x[col_widths_extra$id]) } new_colonnade_sqeezed <- function(x, extra_cols) { structure( x, extra_cols = map_chr(extra_cols, pillar_format_abbrev), class = "squeezed_colonnade" ) } #' @export format.squeezed_colonnade <- function(x, ...) { formatted <- map(x, format_colonnade_tier) new_vertical(as.character(unlist(formatted))) } format_colonnade_tier <- function(x) { xt <- list( title = map(x, `[[`, "title_format"), type = map(x, `[[`, "type_format"), data = map(x, `[[`, "data_format") ) c( invoke(paste, xt$title), style_type_header(invoke(paste, xt$type)), invoke(paste, xt$data) ) } #' @export print.squeezed_colonnade <- function(x, ...) { print(format(x, ...), ...) invisible(x) } # Method registration happens in .onLoad() knit_print.squeezed_colonnade <- function(x, ...) { unlist(map(x, knit_print_squeezed_colonnade_tier)) } knit_print_squeezed_colonnade_tier <- function(x) { header <- map_chr(x, `[[`, "title_format") col <- map(x, function(xx) c(xx[["type_format"]], xx[["data_format"]])) knitr::kable(as.data.frame(col), row.names = NA, col.names = header) } #' Retrieve information about columns that didn't fit the available width #' #' Formatting a [colonnade] object may lead to some columns being omitted #' due to width restrictions. This method returns a character vector that #' describes each of the omitted columns. #' @param x The result of [squeeze()] on a [colonnade] object #' @param ... Unused #' @export #' @examples #' extra_cols(squeeze(colonnade(list(a = 1:3, b = 4:6), width = 8))) extra_cols <- function(x, ...) { UseMethod("extra_cols") } #' @export extra_cols.squeezed_colonnade <- function(x, ...) { attr(x, "extra_cols") } #' @export format.colonnade <- function(x, ...) { format(squeeze(x, ...)) } #' @export print.colonnade <- function(x, ...) { print(format(x, ...)) } #' @rdname colonnade #' @usage NULL #' @aliases NULL colonnade_get_width <- function(x, width, rowid_width) { col_df <- data.frame( id = seq_along(x), max_widths = map_int(map(x, get_widths), max), min_widths = map_int(map(x, get_min_widths), max) ) #' @details #' In a first pass, for each pillar it is decided in which tier it is shown, #' if at all, and how much horizontal space it may use (either its minimum #' or its maximum width). More than one tier may be created if #' `width > getOption("width")`, in this case each tier is at most #' `getOption("width")` characters wide. tier_widths <- get_tier_widths(width, length(x), rowid_width) col_widths_df <- colonnade_compute_tiered_col_widths_df(col_df, tier_widths) #' Remaining space is then distributed proportionally to pillars that do not #' use their desired width. colonnade_distribute_space_df(col_widths_df, tier_widths) } get_tier_widths <- function(width, ncol, rowid_width, tier_width = getOption("width")) { if (is.finite(width)) { pos <- c( seq(0, width - 1, by = tier_width), width ) } else { pos <- seq(0, length.out = ncol + 1L, by = tier_width) } widths <- diff(pos) - rowid_width widths[widths >= 1] } #' @rdname colonnade #' @usage NULL #' @aliases NULL colonnade_compute_tiered_col_widths_df <- function(col_df, tier_widths, fixed_tier_df = data.frame()) { if (nrow(col_df) == 0L) return(data.frame()) tier_id <- max(c(fixed_tier_df$tier), 0L) + 1L tier_df <- colonnade_compute_col_widths_df(col_df, tier_widths[[1]], tier_id) #' @details #' For fitting pillars in one or more tiers, it is first attempted to fit all #' of them in the first tier. if (length(tier_widths) == 1 || all(tier_df$width >= tier_df$max_widths)) { #' If this succeeds (or if no more tiers are available), this fit is #' accepted. return(rbind(fixed_tier_df, tier_df)) } #' Otherwise, an attempt is made to fit all remaining pillars in the remaining #' tiers (with a recursive call). all_tier_df <- colonnade_compute_tiered_col_widths_df( col_df[tier_df$tier == 0, ], tier_widths[-1], rbind(fixed_tier_df, slice(tier_df, tier_df$tier != 0)) ) #' If there still are pillars that don't fit, the minimum-width fit is accepted. if (!all_pillars_fit(all_tier_df)) return(all_tier_df) #' #' In case all remaining pillars fit all remaining tiers, a heuristic #' selects the optimal number of pillars in the first tier. first_expandable <- which(cumsum(tier_df$max_widths + 1L) > tier_widths[[1L]])[[1L]] last_fitting <- utils::tail(which(c(tier_df$tier, 0L) != 0L), 1L) #' The tier is grown starting with all pillars that are fitting with their #' desired width (at least one pillar will be used), and for (n_pillars_in_first_tier in seq2(max(first_expandable - 1L, 1L), last_fitting - 1L)) { #' attempts are made to fit the remaining pillars in the remaining tiers #' (with a recursive call for each attempt). all_tier_try_df <- colonnade_compute_tiered_col_widths_df( slice(col_df, seq2(n_pillars_in_first_tier + 1L, nrow(col_df))), tier_widths[-1], rbind(fixed_tier_df, slice(tier_df, seq_len(n_pillars_in_first_tier))) ) #' The first successful fit if (all_pillars_fit(all_tier_try_df)) return(all_tier_try_df) } #' (or otherwise the initial minimum-width fit) is accepted. all_tier_df } all_pillars_fit <- function(tier_df) { rows <- nrow(tier_df) rows == 0 || tier_df$tier[[nrow(tier_df)]] != 0 } #' @rdname colonnade #' @usage NULL #' @aliases NULL colonnade_compute_col_widths_df <- function(col_df, width, tier_id = 1L) { col_widths <- colonnade_compute_col_widths( col_df$min_widths, col_df$max_widths, width ) n_fitting_cols <- length(col_widths) col_widths <- c(col_widths, rep(0L, nrow(col_df) - length(col_widths))) col_df$width <- col_widths col_df$tier <- ifelse(seq_along(col_widths) > n_fitting_cols, 0L, tier_id) col_df } #' @rdname colonnade #' @usage NULL #' @aliases NULL colonnade_compute_col_widths <- function(min_widths, max_widths, width) { #' @details #' For computing the pillar widths in a single tier, two cases are distinguished: #' 1. When taking the minimum width for each pillar (plus one inter-pillar #' space), at least one pillar does not fit. cum_min_widths <- cumsum(min_widths + 1L) allowed_min <- which(cum_min_widths <= width) if (length(allowed_min) < length(min_widths)) { #' In this case, the minimum width is assigned to all pillars that do fit, #' the non-fitting pillars are stripped. col_widths <- min_widths[allowed_min] } else { #' 1. All pillars fit with their minimum width. In this case, starting at #' the leftmost pillar, the maximum width is allocated to the pillars #' until all available space is used. cum_max_widths <- cumsum(max_widths + 1L) rev_cum_rev_min_widths <- rev(cumsum(rev(min_widths) + 1L)) allowed_max <- (cum_max_widths + c(rev_cum_rev_min_widths[-1L], 0L)) <= width col_widths <- ifelse(allowed_max, max_widths, min_widths) } col_widths } #' @rdname colonnade #' @usage NULL #' @aliases NULL colonnade_distribute_space_df <- function(col_widths_df, tier_widths) { col_widths_split <- split(col_widths_df, col_widths_df$tier) if (any(col_widths_df$tier == 0)) tier_widths <- c(NA, tier_widths) tier_widths <- tier_widths[seq_along(col_widths_split)] col_widths_apply <- map2(col_widths_split, tier_widths, function(x, width) { x$width <- x$width + colonnade_distribute_space(x$width, x$max_widths, width) x }) invoke(rbind, unname(col_widths_apply)) } #' @rdname colonnade #' @usage NULL #' @aliases NULL colonnade_distribute_space <- function(col_widths, max_widths, width) { if (any(is.na(col_widths))) return(col_widths) missing_space <- max_widths - col_widths # Shortcut to avoid division by zero if (all(missing_space == 0L)) return(rep_along(col_widths, 0L)) #' @details #' The remaining space is distributed from left to right. #' Each column gains space proportional to the fraction of missing and #' remaining space, remaining_width <- min(width - sum(col_widths + 1L), sum(missing_space)) added_space_prop <- missing_space / sum(missing_space) * remaining_width #' rounded down. added_space_ceil <- ceiling(added_space_prop) added_space_floor <- floor(added_space_prop) added_space_diff <- added_space_ceil - added_space_floor added_space <- ifelse( #' Any space remaining after rounding is distributed from left to right, #' one space per column. sum(added_space_floor) + cumsum(added_space_diff) <= remaining_width, added_space_ceil, added_space_floor ) added_space } pillar/R/testthat.R0000644000176200001440000000363413204561027013727 0ustar liggesusers#' Test helpers #' #' Expectation for packages that implement a data type with pillar support. #' Allows storing the desired result in a file, #' and comparing the output with the file contents. #' Note that this expectation sets options that affect the formatting of the #' pillar, see examples for usage. #' #' @inheritParams testthat::expect_output_file #' @param ... Unused. #' @param width The width of the output. #' @param crayon Color the output? #' @export #' @examples #' file <- tempfile("pillar", fileext = ".txt") #' #' # The pillar is constructed after options have been set #' # (need two runs because reference file doesn't exist during the first run) #' suppressWarnings(tryCatch( #' expect_known_display(pillar(1:3), file, crayon = FALSE), #' expectation_failure = function(e) {} #' )) #' expect_known_display(pillar(1:3), file, crayon = FALSE) #' #' # Good: Use tidyeval to defer construction #' pillar_quo <- rlang::quo(pillar(1:3)) #' expect_known_display(!!pillar_quo, file, crayon = FALSE) #' #' \dontrun{ #' # Bad: Options set in the active session may affect the display #' integer_pillar <- pillar(1:3) #' expect_known_display(integer_pillar, file, crayon = FALSE) #' } expect_known_display <- function(object, file, ..., width = 80L, crayon = TRUE) { object <- enquo(object) if (crayon) { old <- options(crayon.enabled = TRUE, crayon.colors = 16L, width = width) crayon::num_colors(forget = TRUE) } else { old <- options(crayon.enabled = FALSE, width = width) } on.exit({ options(old) crayon::num_colors(forget = TRUE) }) # FIXME: Use expect_known_output() for testthat >= 2.0.0, and avoid # setting the width in the options above if (utils::packageVersion("testthat") <= "1.0.2") { testthat::expect_output_file(print(eval_tidy(object)), file, update = TRUE) } else { testthat::expect_output_file(print(eval_tidy(object)), file, update = TRUE, width = width) } } pillar/R/zzz.R0000644000176200001440000000164413204561023012717 0ustar liggesusers#' @import rlang NULL .onAttach <- function(...) { crayon::num_colors(forget = TRUE) } .onLoad <- function(libname, pkgname) { register_s3_method("knitr", "knit_print", "squeezed_colonnade") invisible() } register_s3_method <- function(pkg, generic, class, fun = NULL) { stopifnot(is.character(pkg), length(pkg) == 1) stopifnot(is.character(generic), length(generic) == 1) stopifnot(is.character(class), length(class) == 1) if (is.null(fun)) { fun <- get(paste0(generic, ".", class), envir = parent.frame()) } stopifnot(is.function(fun)) if (pkg %in% loadedNamespaces()) { envir <- asNamespace(pkg) registerS3method(generic, class, fun, envir = envir) } # Always register hook in case package is later unloaded & reloaded setHook( packageEvent(pkg, "onLoad"), function(...) { envir <- asNamespace(pkg) registerS3method(generic, class, fun, envir = envir) } ) } pillar/R/rowid-title.R0000644000176200001440000000042013204561023014314 0ustar liggesusersrif_title <- function(has_title, ...) { ret <- structure( list( has_title = has_title ), class = "rif_title" ) ret <- set_width(ret, 0L) ret } #' @export format.rif_title <- function(x, width, ...) { if (!x$has_title) character() else "" } pillar/README.md0000644000176200001440000000777313206761752013043 0ustar liggesusers pillar ====== [![Travis-CI Build Status](https://travis-ci.org/r-lib/pillar.svg?branch=master)](https://travis-ci.org/r-lib/pillar) pillar provides tools for styling columns of data, artfully using colour and unicode characters to Installation ------------ ``` r # install.packages("devtools") devtools::install_github("r-lib/pillar") ``` Usage ----- pillar is not designed for end-users but will eventually be incorporated in packages like [tibble](http://tibble.tidyverse.org). ``` r library(pillar) x <- 123456789 * (10 ^ c(1, -3, -5, NA, -8, -10)) pillar(x) #> #> 1234567890 #> 123457 #> 1235 #> NA #> 1.23 #> 0.0123 ``` If you render this in a console that supports colour, you'll see something that looks like this: Extending --------- The primary user of this package is [tibble](https://github.com/tidyverse/tibble), which in the current development version already lets pillar do all the formatting work. Packages that implement a data type to be used in a tibble column can add color with only a few changes: 1. Implement the `pillar_shaft()` method for your data type. 2. Add pillar to `Suggests` and implement dynamic method registration - If you don't mind the dependency, you can also add it to `Imports`, and import the methods you override with a regular `NAMESPACE` import. [tidyverse/hms\#43](https://github.com/tidyverse/hms/pull/43) shows the changes that were necessary to add colored output for the hms package: - [`pillar.R`](https://github.com/tidyverse/hms/pull/43/files#diff-a63dd6b1da682a8549d03475ac91cdcf) for the actual implementation (old name `colformat.R`) - [`DESCRIPTION`](https://github.com/tidyverse/hms/pull/43/files#diff-35ba4a2677442e210c23a00a5601aba3) for the dependency - [`zzz.R`](https://github.com/tidyverse/hms/pull/43/files#diff-e549505eb95036528ca3b125f62915a6) for the dynamic method registration Some more detail is given below. ### Implementing `pillar_shaft.your_class_name()` This method accepts a vector of arbitrary length and is expected to return an S3 object with the following properties: - It has an attribute `"width"` - It can have an attribute `"min_width"`, if missing, `"width"` is used - It must implement a method `format(x, width, ...)` that can be called with any value between `min_width` and `width` - This method must return an object that inherits from `character` and has attributes `"align"` (with supported values `"left"`, `"right"`, and `"center"`) and `"width"` The function `new_pillar_shaft()` returns such an object, and also correctly formats `NA` values. In many cases, the implementation of `pillar_shaft.your_class_name()` will format the data as a character vector (using color for emphasis) and simply call `new_pillar_shaft()`. See `pillar_shaft.numeric()` for a code that allows changing the display depending on the available width. ### Useful helpers - `style_neg()` to format negative values - `style_num()` to format numbers - `style_subtle()` to de-emphasize ### Dynamic method registration If you avoid the strong dependency on pillar, you need a helper, `register_s3_method()`, which you can borrow e.g. from hms. In `.onLoad()`, call this helper as follows: ``` r register_s3_method("pillar", "pillar_shaft", "your_class_name") ``` Replace `"your_class_name"` with the name of the S3 class of your data type. Inspirations ------------ - [TextPlots](https://github.com/sunetos/TextPlots.jl) for use of Braille characters - [spark](https://github.com/holman/spark) for use of block characters. The earliest use of unicode characters to generate sparklines appears to be [from 2009](https://blog.jonudell.net/2009/01/13/fuel-prices-and-pageviews/). Exercising these ideas to their fullest requires a font with good support for block drawing characters. [PragamataPro](https://www.fsd.it/shop/fonts/pragmatapro/) is one such font. pillar/MD50000644000176200001440000004060513206765060012057 0ustar liggesusersfdc1ec5454b037e4874c280443f3e62c *DESCRIPTION 56a127a6bf155effc0693d28f4187b0d *NAMESPACE 20069f6edb291dacf4633d1c0ecc5182 *NEWS.md feaa904f11d6970ddbc1057a30cf6610 *R/compat-purrr.R c14ca20bda8b74916f94122d09022523 *R/dim.R 216986af95ecc9a884180bb83c7eaa7c *R/extent.R 0472e44168eb6c9d6089424eb64fb34c *R/multi.R 52cb3043e070094feb74e8c9ad9c6a14 *R/ornament.R dd52e37d971b93495398f4dc21ed577e *R/pillar.R c48c5d7379c228d9be401a88a129ea8c *R/rowid-data.R 22c33f92771614f7ad9d3eb661feb9ca *R/rowid-title.R e167a1471b55a21b395007d7eade57fd *R/rowid-type.R 5028cb536a7ae9aee76e89074be485cf *R/scientific.R 0cab008ac471b15f33029c3ed2d4fe25 *R/shaft-simple.R aecc995d3071520bb795092a0b3f4dd1 *R/shaft.R 3b11da78b8c43f46e7b8e0672f223fc8 *R/sigfig.R 8673fc304489c77f486011658314da3a *R/spark-bar.R ab2505e4e6fb2fdf4e85bf1dc14a9425 *R/spark-line.R 8012f3c0ef4e0cd995ff3880a35d03cc *R/strrep.R 62cfae077272229e9279f85fa1758fe0 *R/styles.R 3e17e2d107a895c43bbb8a1d6dfc3266 *R/testthat.R 23d88869566fc9a17ffd130c13ef6ac4 *R/tick.R 9f422de7d5a74de72b876b09451a5423 *R/title.R 9dfb6878101801c9dae905be3da64d75 *R/type-sum.R d617fc6df3c6df25bedcbd7774ebe209 *R/type.R 75fba743efb3d4dda1c9520d3ace3653 *R/utils.R 915071fbacdb04105977ebe9fff6e259 *R/width.R e219bfebb773b26ce096db1e1e7a1b53 *R/zzz.R 36259c575e076b645e90f134ba7ef9ed *README.md c527ba5ed7e8ca4805c9138aac63c7ef *man/colonnade.Rd 9cece36646535ed6e3ec6b2dc2632185 *man/dim_desc.Rd d2b28f0a0f87a9888e448fab400a78c6 *man/expect_known_display.Rd da0fdaaff30a764e2431f45ba4169d9e *man/extra_cols.Rd 91e0f04adb6b27736608b57919d5aca2 *man/figures/colours.png 2a47cfff15af20e9ca5af9529af0ec0a *man/get_extent.Rd 4eb2f0d33b34875a1af2467e459aacd4 *man/new_ornament.Rd b97f9997c1566410da5082fcb8c46ff8 *man/new_pillar_shaft.Rd 5b0aab58dd3b3a7cf1009e02b6854e6c *man/pillar.Rd 104a4d22e2786a316138308407164f79 *man/pillar_shaft.Rd c897b4e7dede1a4267542d9d917ec773 *man/style_subtle.Rd dd7b300dbb77de57b597f8ba9394d1c2 *man/type_sum.Rd 6cf7422e8e8f92b1e263b72654521716 *tests/testthat.R f2274b774982d85b7511e5a8f90b9bb6 *tests/testthat/helper-output.R 8da18397c45a98119db8d2aa332cc7a8 *tests/testthat/out-native/asis-list.txt 852cfc009a578c98ffa3a87d00315eab *tests/testthat/out-native/asis-number.txt 2d945e62f6a4ca2a5c44fcf3218daf9f *tests/testthat/out-native/basic.txt c0da7543b25991a385dd5c47552568b5 *tests/testthat/out-native/date.txt ac51a28da3e4b0efc9ddd1a367f3af69 *tests/testthat/out-native/deal1.txt cd4d084dc3cdca299baccf5a988482d3 *tests/testthat/out-native/deal2.txt b701fa1bb3472a2cb553c71a0c81e453 *tests/testthat/out-native/deal3.txt fe00146f7353a1f2afcf301f227d61c6 *tests/testthat/out-native/decimal-insignif.txt f2bf2abf3377530b98bc53ee1ea41356 *tests/testthat/out-native/escaped.txt a347f258a6c982549ec68681887053b1 *tests/testthat/out-native/factor.txt 2fdbd9093c7897fd6b6060d4a600c572 *tests/testthat/out-native/integer-06.txt 2fdbd9093c7897fd6b6060d4a600c572 *tests/testthat/out-native/integer-07.txt 8d5c81db1287516db574635592265105 *tests/testthat/out-native/integer-08.txt 4bf925017872502659bc355fe2afd56e *tests/testthat/out-native/integer-09.txt c98c0c428c507ee334bf005c03c253bd *tests/testthat/out-native/letters-long-03.txt 9c4badcc8dee2eda6eb01aaf5b66917c *tests/testthat/out-native/letters-long-10.txt ac53236256449edaee64301a685d3ddb *tests/testthat/out-native/letters-long.txt d80e583215bd2e9b07fb86dd6df7816d *tests/testthat/out-native/letters.txt c47a1a8c6ecd3f891b06c93e3dfbb6f4 *tests/testthat/out-native/list-each.txt 24e06b2fbc12455e6ba6facd61fc2dfd *tests/testthat/out-native/list-na.txt 41e84d488e862d9d9640b27f36e556fd *tests/testthat/out-native/list-narrow.txt bc92d74bb6ce7455d39b333d4294220e *tests/testthat/out-native/list-null.txt c9e10f1c8c342b68b87be8b7d06c7882 *tests/testthat/out-native/logical.txt d41d8cd98f00b204e9800998ecf8427e *tests/testthat/out-native/multi-04.txt d41d8cd98f00b204e9800998ecf8427e *tests/testthat/out-native/multi-05.txt d41d8cd98f00b204e9800998ecf8427e *tests/testthat/out-native/multi-06.txt d41d8cd98f00b204e9800998ecf8427e *tests/testthat/out-native/multi-07.txt e6a2bc6dbc31bfeaca24ba62e9d02be9 *tests/testthat/out-native/multi-08.txt 6b948a59642ffb542b3fece7a41ac882 *tests/testthat/out-native/multi-09.txt f889bec86904b4ef22ce5a5a0b0881fd *tests/testthat/out-native/multi-10.txt 1cb68fa6d5a134eecf64f38fefed25e6 *tests/testthat/out-native/multi-11.txt 88dbd1030322b32ddff1387f62166cb3 *tests/testthat/out-native/multi-12.txt 27fbc8cb5c340cfae8e8ff410867a217 *tests/testthat/out-native/multi-13.txt 38a7a011acf97d3e5eb017a21405b701 *tests/testthat/out-native/multi-14.txt 46cf5a6a5d7e8c8444066f588636dee0 *tests/testthat/out-native/multi-15.txt 84612743b7c9dc22025c064700a82a0a *tests/testthat/out-native/multi-16.txt eebbe91094cc72042b8b6d2738071fb1 *tests/testthat/out-native/multi-17.txt 99b668ed16f1ba258260ce9c08578727 *tests/testthat/out-native/multi-18.txt 9c4ea10e52a3cefa6e9cb073ad493c34 *tests/testthat/out-native/multi-19.txt 7a8dd40f356d4a93f5a901de617acbb3 *tests/testthat/out-native/multi-20.txt 75a4069a32b55771765c2779c421b04c *tests/testthat/out-native/multi-21.txt 2ee851877af9bb57eec1dae388fcef50 *tests/testthat/out-native/multi-22.txt ddcabd0d91a9faee314646129c206525 *tests/testthat/out-native/multi-23.txt b87f86353b2d378f0c378a2e15789fbb *tests/testthat/out-native/multi-24.txt 1b593020686e01a83386ee995e3de5ee *tests/testthat/out-native/multi-25.txt de9881816bb3107e6a66af73881d0106 *tests/testthat/out-native/multi-26.txt a7e1d2fd5f9a5af6ebf78ecc7c211a51 *tests/testthat/out-native/multi-27.txt 7a0510074301404133894b2ea2b1a06c *tests/testthat/out-native/multi-28.txt 17299a9f798c6a33e8a6c60da280ec23 *tests/testthat/out-native/multi-29.txt 82afc1bbed48e6eef794bb43abf9d9c1 *tests/testthat/out-native/multi-30.txt 04a686a77bb12c367aa2e1aaccae4be7 *tests/testthat/out-native/multi-31.txt fb98f6a0e50e35bd49a132044116ec91 *tests/testthat/out-native/multi-32.txt 68f71c910aa4f4b009262ada1bd5a2c7 *tests/testthat/out-native/multi-33.txt eaf2eb973f8e2ad1242257c9671f1115 *tests/testthat/out-native/multi-34.txt ded2c2fb016c05e94af7e5cdf22aa939 *tests/testthat/out-native/multi-35.txt fa81951f1b5302047921c8fd94741d89 *tests/testthat/out-native/multi-36.txt e40a882789c0afc5d12918108bd864d1 *tests/testthat/out-native/multi-37.txt 0ad856ebf1f321566cb5727a3496e14d *tests/testthat/out-native/multi-38.txt 08e38bc9c7b12ff58c7bc7626cb9054d *tests/testthat/out-native/multi-39.txt d2bf1ce4031945138462b23008f38c37 *tests/testthat/out-native/multi-extra-10.txt 08e38bc9c7b12ff58c7bc7626cb9054d *tests/testthat/out-native/multi-inf.txt 24c6acc30fccb612ff28b0b4ac4b4238 *tests/testthat/out-native/numeric-04.txt 24c6acc30fccb612ff28b0b4ac4b4238 *tests/testthat/out-native/numeric-07.txt 20bdb94a87f8b7f45ba5d231587276be *tests/testthat/out-native/numeric-10.txt ad0be1259870ac27b48dd4f4c86b67eb *tests/testthat/out-native/numeric-15.txt 93eef5f5c2e8726ed05318eca22b0677 *tests/testthat/out-native/numeric-22.txt 9c5d25e49eb36e5345be0f1dbe1f1a0f *tests/testthat/out-native/ordered.txt 0b4b22f648b2ac1d7c7bc5d173c55784 *tests/testthat/out-native/rowid-3.txt 42a049e166ae9265db566030a3ff2575 *tests/testthat/out-native/rowid-star-title-12.txt 518e519d386e88292a52b3c2e5e953d1 *tests/testthat/out-native/scientific-short-neg.txt 67b6acbe43eda1d7cea8373809ee58f3 *tests/testthat/out-native/scientific.txt 85bb872e2f2e1291553e83b63c5db92e *tests/testthat/out-native/spaces.txt 409eb343fe017217dfd4f40e03eeaa79 *tests/testthat/out-native/tibble-all--30.txt bd1eff5da1250be48b9c24ead1e01452 *tests/testthat/out-native/tibble-all--300-20.txt 7ee04d7c797db5f15ccc3f0fc6e5602b *tests/testthat/out-native/tibble-all--300-30.txt f1021843f8cd35c283359af7aa64681a *tests/testthat/out-native/tibble-all--300-40.txt 57edf71e72ef3999d05324b414763955 *tests/testthat/out-native/tibble-all--300-50.txt 57edf71e72ef3999d05324b414763955 *tests/testthat/out-native/tibble-all--300-60.txt 8c2f978ae5cd6f2e2d7f437cc944cbee *tests/testthat/out-native/tibble-all--300-70.txt 5a9a33e368c78180a2fbb394999884af *tests/testthat/out-native/tibble-all--300.txt fbc3fe739da6f7e73fc85a037bee83ef *tests/testthat/out-native/tibble-iris-3-20.txt e5d3555f1e3087831d02083544a3ee7e *tests/testthat/out-native/tibble-iris-5-30.txt ed9ffe494bf1e985971633a6e8cc9fc1 *tests/testthat/out-native/tibble-mtcars-8-30.txt 9d1a817e5371b7bc057e1d772d116edb *tests/testthat/out-native/tibble-newline.txt 77e550099879988456096aa46604535a *tests/testthat/out-native/tibble-non-syntactic.txt e894707269a4d930e4d71c707876b429 *tests/testthat/out-native/tibble-space.txt 544fe7dc9c8d94241ef9a1b6b35f839d *tests/testthat/out-native/time-posix.txt 33fcb730669cbb7d688643402d0bb454 *tests/testthat/out-native/time.txt f4b4e141d91cfada28f6e8edec436130 *tests/testthat/out-native/title-crayon.txt 550f969c764a590b393296bb57b65adc *tests/testthat/out-native/title-longer.txt 8215639b58724e4a49e8093ab60036a4 *tests/testthat/out-native/title-none.txt 14896cf546672cdf8cdaa26ed9e3a3cc *tests/testthat/out-native/title-short.txt bbe53426158d583227c91d45c69ed34e *tests/testthat/out-native/title-too-long.txt 76e7ab2b8738b58d5b6ee7d1bac0aa13 *tests/testthat/out-native/utf8.txt c0035dcf31be347ce7aa86b4b6f7a628 *tests/testthat/out/asis-list.txt facbf1e6a2785197d9097b664d484e09 *tests/testthat/out/asis-number.txt ba516a6706f52b2a65763d9eee5ec175 *tests/testthat/out/basic.txt ce21cb75fe667b18138c165643fe9f8c *tests/testthat/out/date.txt c52e1a9d08bd6bb103b14c9b98e1ad83 *tests/testthat/out/deal1.txt 90190836ba103d1e49899d076860dba6 *tests/testthat/out/deal2.txt c902ce48fb117aa41227f10478a60c1f *tests/testthat/out/deal3.txt e88f9ef15591eac2e7f8213018aef934 *tests/testthat/out/decimal-insignif.txt 168307897d3e61dab7ffe89d0c0eb0d8 *tests/testthat/out/escaped.txt 838b1075db43d8b3d86dc000c6aaa29c *tests/testthat/out/factor.txt eb20985104faa659f9f294b96fdafbad *tests/testthat/out/integer-06.txt eb20985104faa659f9f294b96fdafbad *tests/testthat/out/integer-07.txt 9207d240650d6922e8167da4817336f3 *tests/testthat/out/integer-08.txt ae8cce07b8335a243a09df1320d6593b *tests/testthat/out/integer-09.txt 48194de6fa81d88544bf1609b10bd3a3 *tests/testthat/out/letters-inf.txt 1ac2a82c2c440e45231aa278fbd146cd *tests/testthat/out/letters-long-03.txt 233793425e5886c6d3944654fb7638f6 *tests/testthat/out/letters-long-10.txt a75618e8436c54098be7d775b944b3ac *tests/testthat/out/letters-long.txt 81c12d2c9cc8e7a436fdc9ed3935b76a *tests/testthat/out/letters.txt 5cfb8cf6170823c5384faed037d084fc *tests/testthat/out/list-each.txt f2ca47e8b6349cbaa9ec13f62cdad4c4 *tests/testthat/out/list-na.txt 51e7fc84b46615f51fd999cfd5be11e8 *tests/testthat/out/list-narrow.txt 2c1c4ca1e2382a5dffd773c24ada4599 *tests/testthat/out/list-null.txt b442ad3430377630c95b1a7591e821d4 *tests/testthat/out/list-one.txt 4958a44b85c881543cfe4cd05172c934 *tests/testthat/out/logical.txt d41d8cd98f00b204e9800998ecf8427e *tests/testthat/out/multi-04.txt d41d8cd98f00b204e9800998ecf8427e *tests/testthat/out/multi-05.txt d41d8cd98f00b204e9800998ecf8427e *tests/testthat/out/multi-06.txt d41d8cd98f00b204e9800998ecf8427e *tests/testthat/out/multi-07.txt ba3d7e7c5881ce328800a78ecf39f2d1 *tests/testthat/out/multi-08.txt 8385804e72bddd49304324847565c0a6 *tests/testthat/out/multi-09.txt bfb0b1cf50030865a07433541988522c *tests/testthat/out/multi-10.txt 61097e2f352edd8fd1ab0db1d1a70e3b *tests/testthat/out/multi-11.txt d8954081bb69fc4f31feee2c2530f744 *tests/testthat/out/multi-12.txt acf6cd39e02e5727a7dbb20e35c6b90f *tests/testthat/out/multi-13.txt 15f4e16fe256a9217c3cd0e7e74c5496 *tests/testthat/out/multi-14.txt df3278c35ca018b2438b367294bd247a *tests/testthat/out/multi-15.txt 42e9ac4006b462cd600a1d043d7db065 *tests/testthat/out/multi-16.txt b9a7e96d34968029099d32d58f5e7629 *tests/testthat/out/multi-17.txt 66fe31417100a6aa61e0fe18f6e32301 *tests/testthat/out/multi-18.txt e1461d98de93ada6e5266e54706171c0 *tests/testthat/out/multi-19.txt 68f4cdd55586b9ef8a9638f366238a3d *tests/testthat/out/multi-20.txt d0e22404cd40edd2ac1e80c01382e474 *tests/testthat/out/multi-21.txt a7193d18334ef86860d819fe50450740 *tests/testthat/out/multi-22.txt ce17d87672d4908f430e5c8c4324edc7 *tests/testthat/out/multi-23.txt 1392f3ce41a5fa7a40cc18422827175a *tests/testthat/out/multi-24.txt b34f2a9548c5f27e38a16b6a70d83435 *tests/testthat/out/multi-25.txt 055ca86969dbd1c158d6c77d5b79564e *tests/testthat/out/multi-26.txt 668b9f6da70d343e47e3472ea5324166 *tests/testthat/out/multi-27.txt 17c2ac384bac2153891bcaaecbeed909 *tests/testthat/out/multi-28.txt 0045d976c82e0a85ca69041cd9c778b8 *tests/testthat/out/multi-29.txt 8e1569debf7ee53acf8ccd6384a3d233 *tests/testthat/out/multi-30.txt 60c3e82bc92a79cede9ac818dcb9b49b *tests/testthat/out/multi-31.txt b23bdd8b10f45449fe1f7800797ce810 *tests/testthat/out/multi-32.txt b969e4665ffd1780110190ecaf53629d *tests/testthat/out/multi-33.txt cfcfbe9829bd18e78b3728e1522cd651 *tests/testthat/out/multi-34.txt eed39625fd60292d9e15ad9a00eceb1d *tests/testthat/out/multi-35.txt 361a5866bc072362da5d553d1337cafe *tests/testthat/out/multi-36.txt e70e0c2d433ef0e48d11914d9119dfb1 *tests/testthat/out/multi-37.txt b45e09f303febc8e970b7e43bee99914 *tests/testthat/out/multi-38.txt 3db25c4055f8d653ff174d07046bfb7f *tests/testthat/out/multi-39.txt a346b9fe6786595c1ef2bec6d73bc2a5 *tests/testthat/out/multi-extra-10.txt 3db25c4055f8d653ff174d07046bfb7f *tests/testthat/out/multi-inf.txt e7c38d55383f457d13b2d312acef1e4b *tests/testthat/out/numeric-04.txt e7c38d55383f457d13b2d312acef1e4b *tests/testthat/out/numeric-07.txt 3ca0e0fa5d53d7353b5cb190ea2de7b4 *tests/testthat/out/numeric-10.txt 946c0569c8cbbbbe037f80da7b33bf96 *tests/testthat/out/numeric-15.txt edb181b9077c0b11ee8a8699a17985fd *tests/testthat/out/numeric-22.txt d753e3150580f18ec685dc169ba601b8 *tests/testthat/out/ordered.txt 07f06f2369ef9f1a3a6c875178c512e0 *tests/testthat/out/rowid-3.txt 95afab616e8be052d538fe3415c3a908 *tests/testthat/out/rowid-star-title-12.txt b35d49936c33854c0a32cc5521fbbc0b *tests/testthat/out/scientific-short-neg.txt 71f6fa33e87806e65830dc3c63d1bd29 *tests/testthat/out/scientific.txt f3210208d319a517d168e685cbbd9969 *tests/testthat/out/spaces.txt 5c7e4a36737ef58a7341014609982a64 *tests/testthat/out/tibble-all--30.txt 782626cc20a6987aa72182fd7b5952e1 *tests/testthat/out/tibble-all--300-20.txt 9c94d1f668a94326082885711987e961 *tests/testthat/out/tibble-all--300-30.txt d616ccf0bf26fb6ac73bc77ebdb14fca *tests/testthat/out/tibble-all--300-40.txt cc7e05adcb85bcbb0c604c8fbc52521e *tests/testthat/out/tibble-all--300-50.txt cc7e05adcb85bcbb0c604c8fbc52521e *tests/testthat/out/tibble-all--300-60.txt a66a6700d1530a0820dff21899e77ab2 *tests/testthat/out/tibble-all--300-70.txt 31fe4bf7f06ec6962514e40dd9287f77 *tests/testthat/out/tibble-all--300.txt 8ca1bc7dd8571afd840a58b31c95290b *tests/testthat/out/tibble-iris-3-20.txt ffac0ac96d622f1e71453972d6602a30 *tests/testthat/out/tibble-iris-5-30.txt d5ea105d10fcec5a605f81a44d0f7159 *tests/testthat/out/tibble-mtcars-8-30.txt fd5b43fc2e5d2ccb71fb546a504517a9 *tests/testthat/out/tibble-newline.txt 2eae9f5e94dc3d750bd9a4d97b861759 *tests/testthat/out/tibble-non-syntactic.txt 321b47f9cb6cf24088c9ac02fb365fbe *tests/testthat/out/tibble-space.txt ac01f4646e1d0a640628bee573579fa0 *tests/testthat/out/time-posix.txt 3988950f67d05af456cdcb7541288b24 *tests/testthat/out/time.txt abbfc892e00d9fb21576bb5a390113ce *tests/testthat/out/title-crayon.txt 490310430dacddb3a5903783c5c64fe0 *tests/testthat/out/title-longer.txt bdaf7c591e10f512472b906b75ba38f9 *tests/testthat/out/title-none.txt bb1fcf0db2613234bab3d7c5c05bf8fb *tests/testthat/out/title-short.txt 396d135ac684a0796a290107b9770d29 *tests/testthat/out/title-too-long.txt 5bc37ff94bdd1b85abdedc2689c4a075 *tests/testthat/out/utf8.txt a08a52cf5be75f903165cab64bcaac11 *tests/testthat/test-format_asis.R ab81eae94a1c088ac8ebd0f7c12b40cc *tests/testthat/test-format_character.R eac93e01b5f2ced49c453c974d5fcd10 *tests/testthat/test-format_date.R 6f0ab07dd31452bd55c218d19ec93680 *tests/testthat/test-format_decimal.R 04c2dc32e2e311777598f5ab035f9fb6 *tests/testthat/test-format_factor.R 88048ab66bcd2d32de82db002a61d997 *tests/testthat/test-format_integer.R fc53a52fc88a4de14c5fca5a7aabaacd *tests/testthat/test-format_list.R b6e309522d23f07c77789099608dd657 *tests/testthat/test-format_logical.R bea5e69223471a6fa125f428e6b623c8 *tests/testthat/test-format_multi.R b8196e226165fc9ac269fb4286b69185 *tests/testthat/test-format_numeric.R d20fa0a60c514e153b38c1568a2f9d94 *tests/testthat/test-format_rowid.R ff678df11cc25000c8fdb34ff1b52296 *tests/testthat/test-format_scientific.R fed342f867af7337a1ccb2685464eb96 *tests/testthat/test-format_time.R 01903da92a08546b0eedcb94fbc37694 *tests/testthat/test-obj-sum.R 39e0de58cd5e32f63dac37681999eea1 *tests/testthat/test-ticks.R 638e4f539e2a792a64630894d9e30538 *tests/testthat/test-title.R pillar/DESCRIPTION0000644000176200001440000000232313206765060013250 0ustar liggesusersPackage: pillar Title: Coloured Formatting for Columns Version: 1.0.1 Authors@R: c( person("Kirill", "Müller", , "krlmlr+r@mailbox.org", role = c("aut", "cre")), person("Hadley", "Wickham", role = "aut"), person("RStudio", role = "cph") ) Description: Provides a 'pillar' generic designed for formatting columns of data using the full range of colours provided by modern terminals. License: GPL-3 Encoding: UTF-8 LazyData: true URL: https://github.com/hadley/pillar BugReports: https://github.com/hadley/pillar/issues Imports: cli, crayon (>= 1.3.4), methods, rlang, utf8 Suggests: knitr, testthat RoxygenNote: 6.0.1 Collate: 'compat-purrr.R' 'dim.R' 'extent.R' 'multi.R' 'ornament.R' 'pillar.R' 'rowid-data.R' 'rowid-title.R' 'rowid-type.R' 'scientific.R' 'shaft.R' 'shaft-simple.R' 'sigfig.R' 'spark-bar.R' 'spark-line.R' 'strrep.R' 'styles.R' 'testthat.R' 'tick.R' 'title.R' 'type-sum.R' 'type.R' 'utils.R' 'width.R' 'zzz.R' NeedsCompilation: no Packaged: 2017-11-27 10:31:09 UTC; muelleki Author: Kirill Müller [aut, cre], Hadley Wickham [aut], RStudio [cph] Maintainer: Kirill Müller Repository: CRAN Date/Publication: 2017-11-27 10:34:24 UTC pillar/man/0000755000176200001440000000000013204561027012310 5ustar liggesuserspillar/man/figures/0000755000176200001440000000000013204561023013750 5ustar liggesuserspillar/man/figures/colours.png0000644000176200001440000005224713204561023016156 0ustar liggesusersPNG  IHDRSg iCCPICC ProfileHTYoUD$49 $K (9h MhFń(*"FtDDb4( :8 ={?έWnw_<8UH8qR,?[ &ƿ=@F )b(gb|VXGckC2έ8wD{c<@x{,`u,Dc<O\8G06I:)(yYDf3xK̐NC z$ հ5N_$gQ  q4 j,M4=syk9 , eO9)7b~ K\a N-K%~g̞ϛWNjdd~I>(J>_%)?_΍_}` *_@d@H~ $$-{xDvM+[NXY;W=ܚד2d.jddR?|$w<= Vm_8|HLE VA!F B5c<\p c>xCF!! #:!b #H "D,C H)RAjIUjLuFRӨ:%;Gsф|Z9 B7{ҥ VC;a`3r5 gO LK@aBBBE|<27_+QxJ+*N*WVf*[+(g*W>|Uy@b"P)P٫rAc3|>%f2fqYibaVkHUEujbJ3lۈegK_hM4eݔ)]S>MUPKR+RWEII^L#Lc.KLO-zl#MTL3\s^ZZZbZ^k=ӴhauyQxr28國!]M]=c(zzO[ t f,35xdH1t4L5fn(hQр18ϸ $ˤ)4t-3,լ9jno.4i90ihZմt O\ZKej&7 O4}w+; }VUW[Xicf÷c˰]ilvf屫n_~`*Ľ{_/55v@t:bCMA̓%hvCnSϮ/>GG^M8zXбNl(jD456u75w syǽWgEYǸA[/{%~5o͉?<1;VVwm8tه#>K̗E_I_˿~k,S&$1+MN#y¸G21aè5n8Q>EVPvx-:4 dwZoldLmC֬qo>*m?a2Jÿ= , . pHYs%%IR$iTXtXML:com.adobe.xmp 252 252 iDOT~(~~*Ya*%IDATx} TUպc֠ #p HЮI4n7Ʃa㻝gۭswBOGӮOew?(qZk߽DkYY`0~ bY:e# (晒[Q%1}Kaي\4mY-y &-7cb;}\ŕKPU l 4D"VDa+N 67]W')(|G#VV~M D Coڏy58K.VŦ܆A&;Eb\* j7?p؜p;p|yEѐH+||0z˔{G HZE₪V˔cO_IM$a[ W@ɇ\ |nHةp z"qrԌwaX81mp;8tc('O>}ˋzW{eP RwXaٮ [V[SȤ4*К`mbu9Ȥ\n-q'1D[^ڝRp_1v0n dQ\KlW>Ҥˈ5[9{6|j^Q|cHS^u)@mA_DsOY#ŸX7çoʲ}ljw=kxwIL&TgiIṢތaʖ?X?-87:ݏyiX0ڶBd+q#2Dx6tX`srj>5 DxꀓȤ6o)J]Yy C|4&.1\3^h{s"נXSquq^5VԼ7WջiA9N'!N>LC:}µXcz'5֕ѱ[uB홎̻'ϗSgw)ю/h1NT]^W-q{ !Skl5:d>#^%Ƨ$,:>Tr\;Jw9jcVW&ޞ2A&{=%X f惼2i 2'ŮQWmGsp djG@"|i乄]VBAw+·fe=Mzv4M}JYƕioȫA~ *]1׺::\o]X,. n==c5|c}kٯl8m{և׮W5[X ŚqyņlÕSv#[ G±R1%]c^z1$XDH1s8|h΅`8L@͂Q&P14];X{G3z$?nGl0'|(^$m@*P)qttѬ{ _apAZW^m뚀& Q֔)t15W*@W *r2 MzE#9x&?gl 5 ˮ|<Ռ7 Sk:VI7[5/ipeh?2ݯkf)H.9Y,N::XCj˶V/֫ut* s]'ѳ2t)g^)[+29?T[+oqK3T8Yw!ֆƎܞ֔il嗿+Nm!aN]#G|n47x0w۵q=aj=;;f` F 0FoXBG~?Cv \$[7 ~ o0`0i2z#|/d #@zZ ^"K8C` !?++C0@&H0%j³!lbM&v~WM^D [ /u6c{p S<(/l8uLM  +Zls&S~m4N~u.NnhoA:CBoJDƼ&fR\ɟ!44HӉ?+@h>6m\"F~όr]?A!ሎm cdm .;aXKN[^9f4^]Nᙙ"G"/LxTZ>˕V"]\ 7hEvV:?|$2詫/NQs/׏M_`cIȍalgW1>pPB3!KEM]IyX!|OBga/E!kBmî <:)MN`xfáE8n5L_'3bO?e7lGe6Jf*__& l܋Erq&ea(M{ZgN\\csCԴɒ܃pʧ0g3teX#7GFx*( ?]e܌ؿ |$ Ru8MBhn䤦rK|vsgSX);PcrB0m2LiǞ yLƬ'"pz/!z\GvlEu̢xd$Dh.-pFD #%Z4n{b7=9)qNr@a鐋Ѓ(?[C Y°vV-Yxz(wiCˮ5s?t3(ݷoD^zJ/n=^).!nw5 $Iam>7fOn:xU r\> ,^=^'oE4qS_G@r3Ֆ\<Rbk~Nn D!}\G/)7EҀ- Z"tLύW\$`3YE2 /dAn9sdeK{^NGd2?]N6o/\G  Ӄ; q"!c3,6M!;dzO#79Ag|!D8#~^+]ˑ9 𥇓i/L#ϰdp1 /[E)Xd⋪Nq x`'Jn=>@1q9O=|whmD+f+E+X\[D@M7cI^DxGlYg7{ 2ԊsLYw"sY.bE>[ce>1i|zs`?5i6'V`ZR&'D~>>]uL^C>E[3k4DADxExkNLO\6=1&Ԍ4OOkr8yV r ֤yMضa7%d-'‹Pl_jč aXLD.\ a{c96mE2LjF5UoLX\*~ =:u[%ih@^F$o9Gm]7U\8y~>Rܤ]7#&ϧ~ -\:hރ]G.#Rhg>:S+B \,3>ĜOы࣢ػMtjB[܋+8s* B!Elb~(/ڄ-˟F#F"c>31?:!"F!$s0gf7/4J+.4(;f^0"3c_ Q2Qj'Ԇh-{ яG'^F?R+ue.kSk䮡~&T\j1䮘"GݵE^Y3q]l[` .FEpE܏g= u;Ƀb7!؊8xlV<6Q㬓7ɕ(`>ۄ^4Y4J'4Un0|Eƌݷ;K[mN !c691YS#EI%g9OxC5ܴm ̓jK{mGm9qz$=. F/Rh#E]4y| ſ@c3GwG#$r~tL)X /BtS~[[DHi}vh=Ae%op?'^TL۩Wz#?q&r2uM;85r$J^&\"/%KӤN9{#unP-43 -VݮZGm맖c0y_+pL2)\mރfѩX67AH)qKE/#v #'8tJh܂Ѐ%<ϘG)(hcxp+f~@ϛcI[#!hI|2l, =ExTKv>zŗԞ?">5]I) ţyDt)5-"YvlkMyhVoZH鑿 >rrјRŘ64T0Y\PNsu}T7q& qv~ꑼ֢AIlž%MN(P1Kčfhwp͛Լ򈈺BxԄ~9;/.K=^lY_Y>)v:4nZ1]|1e9S*,kwJ] R\E$V*d?8]sRjDŽ1HNub 4M\5?ό p71 WQf5ww1X|D['¿ ;ϙdk}EB'&7I#ŎxwBesGkQ臱dҸیOi6d\&a>'& ;| he8nPW=uJ䯿ʚ'N MHejŦX*LSntw ŹZ(䳵^ :;M_Pn=?3OCٕH|A#;܊DOcLD`5ofXQ&^_D#x*^p-}՝ ɳ319vYghpϭ7fQ6.RO WGWO3vs}t|*yh""LA%AT??jF-l vs#(GU4.9sI}XZOGߦo*EGvk14FϵgP{VgX^Ds^,9<23fbҨp[4͈RԼpӟn+w8rw?LP{l$GZT !rD@GMp#|Ѓ(G+JE*;Mp^Wh[QxůoEJ/ Gʵr^“ٙ3s׉7^.G;,E5J zn8D),#FAܽq,9;?߇BM/[@oj<$#ȍMi 4?5t>=XCd8[h{sz7fb |Z >zw' q KulWNNL8;O&|JL+#<< aɫMIV6c&o/;LR pݝ0[l;#"cfEOFC(6䲦wP\5,˜N3ڿ&/@{BD0a)؅-OuL/C#{"}xG* ZX$C!0P`(O!0LC` ?P+'C` @A~<)VN@  2 #@yR >@@Mx6M;_OOM`0a2z#|od #ٌKa9*{.or[[ GXSv QCvh;1F; CbhƳT緧AN\ʟVɇhtk㝎#y\H,+Ev΃>(y$Ÿ߹zzx5?6s1FVSS0ɫw#uTnוCF~xUoAa;.K^jG\6\zˍq_|rSm_/Gח0鄹ov\>%v[n[iH~堡fڔ [kʰHgk=^^*LTroSPKGON8'3W^yOT6՞x%ZyFxۛ ڧhGFX[6}m!"{]*7>Ԕݍ56_髝 rO>8OC}&/U(^!S r9T'Xvٰ1hHW rE޹t_CPΖFo"w)/z"}NzW W z=G@L(`ה|j ,W (ӯw5ox'km>7fONTz䔚"^UnKmYrgs;nk9yrι9F|J{mM0m*")#k>B^R-_ڨ"_g >DL'hT۹76 Sz- U]0#=r&W TR TcQ\4v3y'=ؒkKuP|B2O@s;mD )-m~ALgw)e!'c"^'ř0(>W#‹iu;ą|e!}1=89rX4=Fr8y`< h\LB/1rK}zbFxQV'U|Uk>Ju]*cf } 5.ښkfXO>m-H}긝af/6P 6bOcG஻#1|x4&3bpRNFx!C~]5>^䯤"%/%Q/?O&r+ {ރx ey/%ԢqwZ&+mhbrկ)r4۳SNICXprHE?s?|bZSTs]rax4/LƓcBr[Zu=W R<%ssU962.K)/MDy&}uwndOݽK9b>R&ċ`3ir's"<_ëtek®% &^wi0l0vbnjRpSvd=M=;]&ީxIub0 :FcHCri{Nu8Ro?,g!e+˛OböJ!d/Jh+2 2yՄ (;4o :Up_GU!ţm$$|-[$Y6Tz{?^sY`ۖ>>jsQ`?muq! >~ō}޳hwP; wA0: (,\Ag#8؍i.8ԳÜrK~;pi)LV 2L醃c UΚ6Raݖ4w W^Ef|O$y <g84gi(Ŗ|!3>Gv2<ZUuj iN<{p^!EZ-a iRi~o{ Ï̴k,/9KL11Fy3mԇPD}\!Fup M+TnD. Ҿ& ?G 鲗 ^912y>4i9/1{C4FTve~|D\E5<4Vco}{={(9/FF}q#:Ua\o9G`I^|$;Glw;Kf6"?-dG$Fsw| C?;ڵґ2i0:%Ey$KOYrq~9lJg' JGrR' h}I®Z_{Y+mW. JMX,fKu8܉A䢊KߍС>܇-EwayMQhǞ q Y# rSh&8Xwr,2^4=yaǭ?1ѕHs*55U:˕*ךNK$ht/zY^k;ޡ۪Ptzq< RvR8\C.E^P@$(sQ)u8|?]עSx|l<`..CC@tё^zz鵽JP!96`=\yn۳"볲>}jgYфP(}T߳5bKRyi;۵0ۺFW͘?ewسv,~ɇN %-4_Ϟb{x yЍY"A#'͑[Zm Qd;y|ڌAthy5Kkv?xßh=crd_D#@; 5͓HC[8wkK@):ǓY aIw[`yr Tq]+뒓p;}}~IO0?U)UtZawD4}ka,?wѯғgߎ^N1A1E?Fyc.rJdoB{)d-2Jz eZV'W`֤ ަf8}Ҫ+gf7~%#3>W^tа]w* Z˟ˆ++os⑰Թ^"v,ή-ܯc:x{eC*rt@L)st\q4|;h~@a/#2GpYB ӡoM\tjjS~ @ kD;DqTB ~5Y""*!?Ú,~ozXDg_GOJ!&iY_FxabF2Z]jb)"||N@k:#|!J)]%ILy a:>΀'9š#7*˓e&U#^*qe,ULTSOцy"DL&%ވ'=#=fmbOgnx砉{?/`ʭyDنYx;ZUYݓx|xH{ע0>^H'>{BB*oMjYQś^;T/-[R[ڵOM w 1!Uj %~@O,ûO^Ao5G$Ϝ_ l+2ޤik!QC\?. Rw]Z} /A7fOLQ$q'|Ԍ x_1IUi/ÒěqD2ʻ;2o-d:/; Vx;,KP^!/_ۿOAGm5fZ!+UT\ A d ɥҠIBw޷4 _u=YBnJ)2)G[ZP?{ۿsI%;uک^xa>U6Ox?](2;nO]_@Xnt/?D8pwxzdn)^< Țmo˽^#p-O+ctn'«1[zo$j{ -y\+\J>W,〪Mx`.V~޲O]5GAx}"Cgډqx1)i78d6/?-"h,ŬKxP,N;u7nw(/N#@Dn_ʥWؘ %5<;w?ٺ1|JyޓcOts3>|" (Y)gm(k"|\`Nd#rՆ+qY%_]SdYg"0>^H'ëTSH7 F,OMz#:?'~A`|V=ˇڇ&'@3>h'-;aW[HkW/N(DU Y& ]EoԘG 1Q&y/N!?<'|H "|R&*$!I>)n DHZ@ IFb< ; $BH|@ JR <.Z2=͗X}̻|ѴLY'5 a.?R*="8LHGj3JAY3e}Cluk.lRPl;쬽O/YG9$R< F}[᠝UWe|iPycHzKfnú9ldZ1ԐԤOZ"y#rJ b9{\ôFww˅ٯyk5Q[\-xsHKIlx0a iP0ul-`>$ 'sJH9+|lfXz@XY:=fɭ;OI񯂇y<& /G]G74qճB?̪]̸_ۀ/$?p;Xa2ANxȖjeVxȺ,a^Wz D`G0kVuk<|&}ݦ>6֦i7Do] ^cP c}VSjla.cVdZ6VDcPVAk?|MP鱀˾^%y]}@F]~ (ɚ@O;^sϹ]%;8gt5l}d3>dNՉLOĻeAcY--ӬffBY7>΀&̍C]Wf.nVWijGF0JA ,x7` Yk_o]k7 V_r0D(ijm̈LbRUxYac6TEaѵ CR |>6oYAD |F(j~WVo4K("|2޵+s7p?Q8 ]=sCx00-]Jg&oG+NэS\l'uv\6!9B|ˋgbې=pym]}8>u MJ4a:-',J&B"TP0= .lQ: tZZ@g.a."{ObSA ֪"Quz*z˺=dΥ'w{/7ԤOvj~Z BN2yAzyƺQ'GɊ>Y"|! /LF(~Y }QI "|$*"!+BI> nDX!Iz$@7H a#4G~A)4'2F!Q"@!Ht~|@  ϲ*u]N46>%päf̽1{q} ݣőū0sj"«/M|跗֩pwWtFV&&NSj=n96HII02:cB:҃!D1#n GG*P(%G( kSo߂.42bbЈ}#ޣYLO__\r1}x<'jb-6M?ZZvll]²=1ZިFmSϐXoRn] o7 =_=]<l;_?N.ηƮQc`X3eDJ\N#GD]1\4,7h4{,WFׯ1oD/Et]oʴEKI& ~.^+:ix0jo!g7"3D\K]9wy,|qQg#yu<6݁%~Oޓ-xRs7釐v)R=`=Gɯh֢1'~X(T3RG_5hZ $},O]Ѷ4vݿavlfYYƋQncJi"%̌TfeYh7; `7j٬>u{ ~zE@ z|DڪZ#Yw0K۫_Ӿ8k}AV>ͬѥ$ə?&~v,j5^VLSZ},&OM"M8"M*_jЮ*j~Y5W0zj9aX(#QGb^jW?Xu6#ulune2`'xI'}n3o3{~"F~xg֒3&kiҷ-W ;il(ڢ8S/==WZx&Ux?fs]}?{43g ,˸QϿ/gaԮr!]Ex*d~ЧІoœy_ŌIU?*Hr$ *6"*0 Td&֙A<'R :GԶHaу89 Z҄1I8X{u!i?dhR7GhmS'quHc:4vF`wf<ylo.= _眇Օ-@+^]DF%n()+5G<|Y%se[vOSZϱNW䭐ҫiԺEˠ=q E֙G=e"%G6וm}gv}ְ`o֕kײoMgV̴{9{T~[e p<8׎-GU]ƁVo+ir֮Ắ bXɶޝna1z6lQB=fEÆ3Ӻ߰XwkdA{m^ۚz"gRu5o31[w3/ù }{~oDsc?S=,.~)W);7'4"~[`c=v\:!ir7pzȞ>zG~ʟ*6v"wZ?5<*( ڏխkcfG뮏\k-W9K?"F3q7& ǩr˷܇ٗG#ָFXHюPjZҮANol \ &Ş B jY]y4ʪzhM?NV QfN 2N|PsmD?jȠr¶Fnƿ S\> ?BRP*vY{OQIYK 0ۉ #U@ QPf\/>Uh>~߳Tii>A YY4Ôi2h?#EA$ z‹Ɔ"U ?\qF8Bh _4*BF#A\4/[I!B#@ .ͭq6ZdO~4"A9"#|PmH>!v˨IENDB`pillar/man/colonnade.Rd0000644000176200001440000000646613204561027014555 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/multi.R \name{colonnade} \alias{colonnade} \alias{squeeze} \title{Format multiple vectors in a tabular display} \usage{ colonnade(x, has_row_id = TRUE, width = NULL, ...) squeeze(x, width = NULL, ...) } \arguments{ \item{x}{A list of vectors to format} \item{has_row_id}{Include a column indicating row IDs? Pass \code{"*"} to mark the row ID column with a star.} \item{width}{Default width of the entire output, optional} \item{...}{Ignored} } \description{ The vectors are formatted to fit horizontally into a user-supplied number of characters per row. The \code{squeeze()} function is called by \code{\link[=format]{format()}} and \code{\link[=print]{print()}} and usually doesn't need to be called manually. It returns an object suitable for printing and formatting at a fixed width with additional information about omitted columns. } \details{ In a first pass, for each pillar it is decided in which tier it is shown, if at all, and how much horizontal space it may use (either its minimum or its maximum width). More than one tier may be created if \code{width > getOption("width")}, in this case each tier is at most \code{getOption("width")} characters wide. Remaining space is then distributed proportionally to pillars that do not use their desired width. For fitting pillars in one or more tiers, it is first attempted to fit all of them in the first tier. If this succeeds (or if no more tiers are available), this fit is accepted. Otherwise, an attempt is made to fit all remaining pillars in the remaining tiers (with a recursive call). If there still are pillars that don't fit, the minimum-width fit is accepted. In case all remaining pillars fit all remaining tiers, a heuristic selects the optimal number of pillars in the first tier. The tier is grown starting with all pillars that are fitting with their desired width (at least one pillar will be used), and attempts are made to fit the remaining pillars in the remaining tiers (with a recursive call for each attempt). The first successful fit (or otherwise the initial minimum-width fit) is accepted. For computing the pillar widths in a single tier, two cases are distinguished: \enumerate{ \item When taking the minimum width for each pillar (plus one inter-pillar space), at least one pillar does not fit. In this case, the minimum width is assigned to all pillars that do fit, the non-fitting pillars are stripped. \item All pillars fit with their minimum width. In this case, starting at the leftmost pillar, the maximum width is allocated to the pillars until all available space is used. } The remaining space is distributed from left to right. Each column gains space proportional to the fraction of missing and remaining space, rounded down. Any space remaining after rounding is distributed from left to right, one space per column. } \examples{ colonnade(list(a = 1:3, b = letters[1:3])) long_string <- list(paste(letters, collapse = " ")) colonnade(long_string, width = 20) colonnade(long_string, has_row_id = FALSE, width = 20) # The width can also be overridden when calling format() or print(): print(colonnade(long_string), width = 20) # If width is larger than getOption("width"), multiple tiers are created: colonnade(rep(long_string, 4), width = Inf) squeeze(colonnade(long_string), width = 20) } pillar/man/new_pillar_shaft.Rd0000644000176200001440000000313313204561027016120 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/shaft.R, R/shaft-simple.R \name{new_pillar_shaft} \alias{new_pillar_shaft} \alias{new_pillar_shaft_simple} \title{Constructor for column data} \usage{ new_pillar_shaft(x, ..., width, min_width = width, subclass) new_pillar_shaft_simple(formatted, ..., width = NULL, align = "left", min_width = NULL, na_indent = 0L) } \arguments{ \item{x}{An object} \item{...}{Additional attributes} \item{width}{The maximum column width.} \item{min_width}{The minimum allowed column width, \code{width} if omitted.} \item{subclass}{The name of the subclass.} \item{formatted}{An object coercible to \link{character}.} \item{align}{Alignment of the column.} \item{na_indent}{Indention of \code{NA} values.} } \description{ The \code{new_pillar_shaft()} constructor creates objects of the \code{"pillar_shaft"} class. This is a virtual or abstract class, you must specify the \code{subclass} argument. By convention, this should be a string that starts with \code{"pillar_shaft_"}. See \code{vignette("extending", package = "tibble")} for usage examples. \code{new_pillar_shaft_simple()} provides an implementation of the \code{pillar_shaft} class suitable for output that has a fixed formatting, which will be truncated with a continuation character (ellipsis or \code{~}) if it doesn't fit the available width. By default, the required width is computed from the natural width of the \code{formatted} argument. } \details{ The \code{formatted} argument may also contain ANSI escapes to change color or other attributes of the text, see \link{crayon}. } pillar/man/type_sum.Rd0000644000176200001440000000140213204561023014435 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/type-sum.R \name{type_sum} \alias{type_sum} \alias{obj_sum} \alias{is_vector_s3} \title{Provide a succinct summary of an object} \usage{ type_sum(x) obj_sum(x) is_vector_s3(x) } \arguments{ \item{x}{an object to summarise. Generally only methods of atomic vectors and variants have been implemented.} } \description{ \code{type_sum()} gives a brief summary of object type. Objects that commonly occur in a data frame should return a string with four or less characters. \code{obj_sum()} also includes the size of the object if \code{is_vector_s3()} is \code{TRUE}. } \examples{ obj_sum(1:10) obj_sum(matrix(1:10)) obj_sum(Sys.Date()) obj_sum(Sys.time()) obj_sum(mean) } \keyword{internal} pillar/man/expect_known_display.Rd0000644000176200001440000000262613206760106017037 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/testthat.R \name{expect_known_display} \alias{expect_known_display} \title{Test helpers} \usage{ expect_known_display(object, file, ..., width = 80L, crayon = TRUE) } \arguments{ \item{object}{object to test} \item{file}{Path to a "golden" text file that contains the desired output.} \item{...}{Unused.} \item{width}{The width of the output.} \item{crayon}{Color the output?} } \description{ Expectation for packages that implement a data type with pillar support. Allows storing the desired result in a file, and comparing the output with the file contents. Note that this expectation sets options that affect the formatting of the pillar, see examples for usage. } \examples{ file <- tempfile("pillar", fileext = ".txt") # The pillar is constructed after options have been set # (need two runs because reference file doesn't exist during the first run) suppressWarnings(tryCatch( expect_known_display(pillar(1:3), file, crayon = FALSE), expectation_failure = function(e) {} )) expect_known_display(pillar(1:3), file, crayon = FALSE) # Good: Use tidyeval to defer construction pillar_quo <- rlang::quo(pillar(1:3)) expect_known_display(!!pillar_quo, file, crayon = FALSE) \dontrun{ # Bad: Options set in the active session may affect the display integer_pillar <- pillar(1:3) expect_known_display(integer_pillar, file, crayon = FALSE) } } pillar/man/style_subtle.Rd0000644000176200001440000000157213204561027015322 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/sigfig.R, R/styles.R \name{style_num} \alias{style_num} \alias{style_subtle} \alias{style_na} \alias{style_neg} \title{Styling helpers} \usage{ style_num(x, negative, significant = rep_along(x, TRUE)) style_subtle(x) style_na(x) style_neg(x) } \arguments{ \item{x}{The character vector to style.} \item{negative, significant}{Logical vector the same length as \code{x} that indicate if the values are negative and significant, respectively} } \description{ Functions that allow implementers of formatters for custom data types to maintain a consistent style with the default data types. } \examples{ style_num( c("123", "456"), negative = c(TRUE, FALSE) ) style_num( c("123", "456"), negative = c(TRUE, FALSE), significant = c(FALSE, FALSE) ) style_subtle("text") style_na("NA") style_neg("123") } pillar/man/pillar_shaft.Rd0000644000176200001440000000405613204561027015254 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/shaft.R \name{pillar_shaft} \alias{pillar_shaft} \alias{print.pillar_shaft} \alias{format.pillar_shaft} \alias{pillar_shaft.logical} \alias{pillar_shaft.numeric} \alias{pillar_shaft.Date} \alias{pillar_shaft.POSIXt} \alias{pillar_shaft.character} \alias{pillar_shaft.list} \alias{pillar_shaft.AsIs} \alias{pillar_shaft.default} \title{Column data} \usage{ pillar_shaft(x, ...) \method{print}{pillar_shaft}(x, width = NULL, ...) \method{format}{pillar_shaft}(x, width, ...) \method{pillar_shaft}{logical}(x, ...) \method{pillar_shaft}{numeric}(x, ..., sigfig = 3) \method{pillar_shaft}{Date}(x, ...) \method{pillar_shaft}{POSIXt}(x, ...) \method{pillar_shaft}{character}(x, ...) \method{pillar_shaft}{list}(x, ...) \method{pillar_shaft}{AsIs}(x, ...) \method{pillar_shaft}{default}(x, ...) } \arguments{ \item{x}{A vector to format} \item{...}{Unused, for extensibility.} \item{width}{Width for printing and formatting.} \item{sigfig}{Minimum number of significant figures to display. Numbers larger than 1 will potentially show more significant figures than this but they will be greyed out.} } \description{ Internal class for formatting the data for a column. \code{pillar_shaft()} is a coercion method that must be implemented for your data type to display it in a tibble. This class comes with a default method for \code{\link[=print]{print()}} that calls \code{\link[=format]{format()}}. If \code{print()} is called without \code{width} argument, the natural width will be used when calling \code{format()}. Usually there's no need to implement this method for your subclass. Your subclass must implement \code{format()}, the default implementation just raises an error. Your \code{format()} method can assume a valid value for the \code{width} argument. } \details{ The default method will currently coerce via \code{\link[=as.character]{as.character()}}, but you should not rely on this behavior. } \examples{ pillar_shaft(1:3) pillar_shaft(1.5:3.5) pillar_shaft(NA) pillar_shaft(c(1:3, NA)) } pillar/man/get_extent.Rd0000644000176200001440000000112213204561027014741 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/extent.R \name{get_extent} \alias{get_extent} \alias{get_max_extent} \title{Calculate display width} \usage{ get_extent(x) get_max_extent(x) } \arguments{ \item{x}{A character vector.} } \description{ \code{get_extent()} calculates the display width for each string in a character vector. \code{get_max_extent()} calculates the maximum display width of all strings in a character vector, zero for empty vectors. } \examples{ get_extent(c("abc", "de")) get_extent("\\u904b\\u6c23") get_max_extent(c("abc", "de")) } pillar/man/dim_desc.Rd0000644000176200001440000000060613204561023014344 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/dim.R \name{dim_desc} \alias{dim_desc} \title{Format dimensions} \usage{ dim_desc(x) } \arguments{ \item{x}{The object to format the dimensions for} } \description{ Multi-dimensional objects are formatted as \code{a x b x ...}, for vectors the length is returned. } \examples{ dim_desc(1:10) dim_desc(Titanic) } pillar/man/extra_cols.Rd0000644000176200001440000000117113204561027014742 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/multi.R \name{extra_cols} \alias{extra_cols} \title{Retrieve information about columns that didn't fit the available width} \usage{ extra_cols(x, ...) } \arguments{ \item{x}{The result of \code{\link[=squeeze]{squeeze()}} on a \link{colonnade} object} \item{...}{Unused} } \description{ Formatting a \link{colonnade} object may lead to some columns being omitted due to width restrictions. This method returns a character vector that describes each of the omitted columns. } \examples{ extra_cols(squeeze(colonnade(list(a = 1:3, b = 4:6), width = 8))) } pillar/man/new_ornament.Rd0000644000176200001440000000172313204561027015276 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/ornament.R \name{new_ornament} \alias{new_ornament} \title{Helper to define the contents of a pillar} \usage{ new_ornament(x, width = NULL, align = NULL) } \arguments{ \item{x}{A character vector with formatting, see \link{crayon}} \item{width}{An optional width of the resulting pillar, computed from \code{x} if missing} \item{align}{Alignment, one of \code{"left"} or \code{"right"}} } \description{ This function is useful if your data renders differently depending on the available width. In this case, implement the \code{\link[=pillar_shaft]{pillar_shaft()}} method for your class to return a subclass of "pillar_shaft" and have the \code{\link[=format]{format()}} method for this subclass call \code{new_ornament()}. See the implementation of \code{pillar_shaft.numeric()} and \code{format.pillar_shaft_decimal()} for an example. } \examples{ new_ornament(c("abc", "de"), align = "right") } pillar/man/pillar.Rd0000644000176200001440000000222313204561023014055 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/pillar.R \name{pillar} \alias{pillar} \title{Format a vector suitable for tabular display} \usage{ pillar(x, title = NULL, width = NULL, ...) } \arguments{ \item{x}{A vector to format} \item{title}{An optional title for the column} \item{width}{Default width, optional} \item{...}{Other arguments passed to methods} } \description{ \code{pillar()} formats a vector using one row for a title (if given), one row for the type, and \code{length(x)} rows for the data. } \examples{ x <- 123456789 * (10 ^ c(-1, -3, -5, NA, -8, -10)) pillar(x) pillar(-x) pillar(runif(10)) pillar(rcauchy(20)) # Special values are highlighted pillar(c(runif(5), NA, NaN, Inf, -Inf)) # Very wide ranges will be displayed in scientific format pillar(c(1e10, 1e-10), width = 20) pillar(c(1e10, 1e-10)) x <- c(FALSE, NA, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE) pillar(x) x <- c("This is string is rather long", NA, "?", "Short") pillar(x) pillar(x, width = 30) pillar(x, width = 5) date <- as.Date("2017-05-15") pillar(date + c(1, NA, 3:5)) pillar(as.POSIXct(date) + c(30, NA, 600, 3600, 86400)) }