Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Printing wide prt objects is broken (ellipses on wrong lines) #8

Open
DarwinAwardWinner opened this issue Sep 5, 2024 · 0 comments

Comments

@DarwinAwardWinner
Copy link

When printing a prt object that is wider than the screen using print(x, width = Inf), prt places the ellipses on the wrong lines. Reprex below:

#!/usr/bin/env Rscript
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(prt)

## Make a data frame with lots of rows and lots of columns
big_df <- data.frame(A=rep(letters, each = 4))
for (i in LETTERS) {
    big_df[[i]] <- rep(letters, each = 4)
}

## Looks ok
big_tbl <- as_tibble(big_df)
print(big_tbl, width = Inf)
#> # A tibble: 104 × 26
#>    A     B     C     D     E     F     G     H     I     J     K     L     M    
#>    <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#>  1 a     a     a     a     a     a     a     a     a     a     a     a     a    
#>  2 a     a     a     a     a     a     a     a     a     a     a     a     a    
#>  3 a     a     a     a     a     a     a     a     a     a     a     a     a    
#>  4 a     a     a     a     a     a     a     a     a     a     a     a     a    
#>  5 b     b     b     b     b     b     b     b     b     b     b     b     b    
#>  6 b     b     b     b     b     b     b     b     b     b     b     b     b    
#>  7 b     b     b     b     b     b     b     b     b     b     b     b     b    
#>  8 b     b     b     b     b     b     b     b     b     b     b     b     b    
#>  9 c     c     c     c     c     c     c     c     c     c     c     c     c    
#> 10 c     c     c     c     c     c     c     c     c     c     c     c     c    
#>    N     O     P     Q     R     S     T     U     V     W     X     Y     Z    
#>    <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#>  1 a     a     a     a     a     a     a     a     a     a     a     a     a    
#>  2 a     a     a     a     a     a     a     a     a     a     a     a     a    
#>  3 a     a     a     a     a     a     a     a     a     a     a     a     a    
#>  4 a     a     a     a     a     a     a     a     a     a     a     a     a    
#>  5 b     b     b     b     b     b     b     b     b     b     b     b     b    
#>  6 b     b     b     b     b     b     b     b     b     b     b     b     b    
#>  7 b     b     b     b     b     b     b     b     b     b     b     b     b    
#>  8 b     b     b     b     b     b     b     b     b     b     b     b     b    
#>  9 c     c     c     c     c     c     c     c     c     c     c     c     c    
#> 10 c     c     c     c     c     c     c     c     c     c     c     c     c    
#> # ℹ 94 more rows

## Ellipses after the first on are in the wrong place
big_prt <- as_prt(big_tbl)
print(big_prt, width = Inf)
#> # A prt:        104 × 26
#> # Partitioning: [104] rows
#>     A     B     C     D     E     F     G     H     I     J     K     L
#>     <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1   a     a     a     a     a     a     a     a     a     a     a     a
#> 2   a     a     a     a     a     a     a     a     a     a     a     a
#> 3   a     a     a     a     a     a     a     a     a     a     a     a
#> 4   a     a     a     a     a     a     a     a     a     a     a     a
#> 5   b     b     b     b     b     b     b     b     b     b     b     b
#> …
#> 100 y     y     y     y     y     y     y     y     y     y     y     y
#> 101 z     z     z     z     z     z     z     z     z     z     z     z
#> 102 z     z     z     z     z     z     z     z     z     z     z     z
#> 103 z     z     z     z     z     z     z     z     z     z     z     z
#> 104 z     z     z     z     z     z     z     z     z     z     z     z
#>     M     N     O     P     Q     R     S     T     U     V     W     X
#>     <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#> …
#> 1   a     a     a     a     a     a     a     a     a     a     a     a
#> 2   a     a     a     a     a     a     a     a     a     a     a     a
#> 3   a     a     a     a     a     a     a     a     a     a     a     a
#> 4   a     a     a     a     a     a     a     a     a     a     a     a
#> 5   b     b     b     b     b     b     b     b     b     b     b     b
#> 100 y     y     y     y     y     y     y     y     y     y     y     y
#> 101 z     z     z     z     z     z     z     z     z     z     z     z
#> …
#> 102 z     z     z     z     z     z     z     z     z     z     z     z
#> 103 z     z     z     z     z     z     z     z     z     z     z     z
#> 104 z     z     z     z     z     z     z     z     z     z     z     z
#>     Y     Z
#>     <chr> <chr>
#> 1   a     a
#> 2   a     a
#> 3   a     a
#> 4   a     a
#> 5   b     b
#> 100 y     y
#> 101 z     z
#> 102 z     z
#> 103 z     z
#> 104 z     z
#> # ℹ 99 more rows

Created on 2024-09-05 with reprex v2.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant