Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
apacheGH-38916: [R] Simplify dataset and table print output (apache#3…
…8917) ### Rationale for this change When printing objects with data with lots of rows, the output is long and unwieldy. ### What changes are included in this PR? * Truncates long schema print output and adds the number of columns to dataset print output. * Add number of columns to output so it's clear how many there are in total ### Are these changes tested? Yes ### Are there any user-facing changes? Yes Before: ``` r library(arrow) x <- tibble::tibble(!!!letters, .rows = 5) InMemoryDataset$create(x) #> InMemoryDataset #> "a": string #> "b": string #> "c": string #> "d": string #> "e": string #> "f": string #> "g": string #> "h": string #> "i": string #> "j": string #> "k": string #> "l": string #> "m": string #> "n": string #> "o": string #> "p": string #> "q": string #> "r": string #> "s": string #> "t": string #> "u": string #> "v": string #> "w": string #> "x": string #> "y": string #> "z": string arrow_table(x) #> Table #> 5 rows x 26 columns #> $"a" <string> #> $"b" <string> #> $"c" <string> #> $"d" <string> #> $"e" <string> #> $"f" <string> #> $"g" <string> #> $"h" <string> #> $"i" <string> #> $"j" <string> #> $"k" <string> #> $"l" <string> #> $"m" <string> #> $"n" <string> #> $"o" <string> #> $"p" <string> #> $"q" <string> #> $"r" <string> #> $"s" <string> #> $"t" <string> #> $"u" <string> #> $"v" <string> #> $"w" <string> #> $"x" <string> #> $"y" <string> #> $"z" <string> record_batch(x) #> RecordBatch #> 5 rows x 26 columns #> $"a" <string> #> $"b" <string> #> $"c" <string> #> $"d" <string> #> $"e" <string> #> $"f" <string> #> $"g" <string> #> $"h" <string> #> $"i" <string> #> $"j" <string> #> $"k" <string> #> $"l" <string> #> $"m" <string> #> $"n" <string> #> $"o" <string> #> $"p" <string> #> $"q" <string> #> $"r" <string> #> $"s" <string> #> $"t" <string> #> $"u" <string> #> $"v" <string> #> $"w" <string> #> $"x" <string> #> $"y" <string> #> $"z" <string> ``` After: ``` r library(arrow) x <- tibble::tibble(!!!letters, .rows = 5) InMemoryDataset$create(x) #> InMemoryDataset #> 26 columns #> "a": string #> "b": string #> "c": string #> "d": string #> "e": string #> "f": string #> "g": string #> "h": string #> "i": string #> "j": string #> "k": string #> "l": string #> "m": string #> "n": string #> "o": string #> "p": string #> "q": string #> "r": string #> "s": string #> "t": string #> ... #> Use `schema()` to see entire schema arrow_table(x) #> Table #> 5 rows x 26 columns #> $"a" <string> #> $"b" <string> #> $"c" <string> #> $"d" <string> #> $"e" <string> #> $"f" <string> #> $"g" <string> #> $"h" <string> #> $"i" <string> #> $"j" <string> #> $"k" <string> #> $"l" <string> #> $"m" <string> #> $"n" <string> #> $"o" <string> #> $"p" <string> #> $"q" <string> #> $"r" <string> #> $"s" <string> #> $"t" <string> #> ... #> Use `schema()` to see entire schema record_batch(x) #> RecordBatch #> 5 rows x 26 columns #> $"a" <string> #> $"b" <string> #> $"c" <string> #> $"d" <string> #> $"e" <string> #> $"f" <string> #> $"g" <string> #> $"h" <string> #> $"i" <string> #> $"j" <string> #> $"k" <string> #> $"l" <string> #> $"m" <string> #> $"n" <string> #> $"o" <string> #> $"p" <string> #> $"q" <string> #> $"r" <string> #> $"s" <string> #> $"t" <string> #> ... #> Use `schema()` to see entire schema ``` * Closes: apache#38916 Lead-authored-by: Nic Crane <[email protected]> Co-authored-by: Bryce Mecum <[email protected]> Signed-off-by: Nic Crane <[email protected]>
- Loading branch information