Skip to content

(single) record view #317

@elbersb

Description

@elbersb

This may have come up before, but I couldn't find anything in the tibble package or here.

It might be desirable to implement a printing mode that "transposes" the tibble. This came up when demonstrating bloom::glance on a presentation slide, where the output looks like this:

glance(mod)

#> # A tibble: 1 x 12 
#> r.squared adj.r.squared sigma statistic p.value df 
#>     <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 
#>       1 0.652 0.652 7.62 3192. 0 1 
#> # ... with 6 more variables: logLik <dbl>, AIC <dbl>, 
#> # BIC <dbl>, deviance <dbl>, df.residual <int>, 
#> # nobs <int>

(the white space got messed up a bit when copying from the PDF)

In this case, all columns are numeric, so the matrix transpose doesn't look so bad:

> t(glance(mod))
                       [,1]
r.squared         0.7168580
adj.r.squared     0.7165251
sigma             6.8773735
statistic      2153.2928344
p.value           0.0000000
df                2.0000000
logLik        -5702.0854721
AIC           11412.1709442
BIC           11433.9338790
deviance      80454.3501172
df.residual    1701.0000000
nobs           1704.0000000

However, tibble could of course support this more fully, including a column for the column type and applying the correct formatting. A similar feature exists in PostgreSQL: https://stackoverflow.com/questions/9604723/alternate-output-format-for-psql. I always found this nice to have.

One could even go so far as treating a single row like a "record", and defaulting to printing it this way. But that might be confusing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions