Skip to content

Obey max argument and max.print option in obj_print()? #1355

Open
@krlmlr

Description

@krlmlr

We're already obeying getOption("max.print") via print(format(x)), but we're still calling format() on the full vctr. We could do a better job by providing the necessary infrastructure in obj_print() and passing max to obj_print_footer() .

I'll experiment with pillar::num() and pillar::char() .

print(vctrs::new_vctr(letters), max = 10)
#> <vctrs_vctr[26]>
#>  [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
options(max.print = 5)
print(vctrs::new_vctr(letters))
#> <vctrs_vctr[26]>
#> [1] a b c d e
#>  [ reached getOption("max.print") -- omitted 21 entries ]

print(letters, max = 10)
#>  [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j"
#>  [ reached getOption("max.print") -- omitted 16 entries ]
print(letters)
#> [1] "a" "b" "c" "d" "e"
#>  [ reached getOption("max.print") -- omitted 21 entries ]

Created on 2021-04-08 by the reprex package (v1.0.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions