Skip to content

Option to print the number of columns #6663

Description

@KyleHaynes

Could data.table:::print.data.table look to gain an option to print the number of columns?

Happy to put a PR in if so.

If yes, things to consider

  • Parameter name (e.g. ncols to match nrows?)
  • Option name (e.g. getOption("datatable.print.ncols")
  • Label (e.g. ncol)
  • Position (header vs footer?)
  • Don't print if 0 rows (print.data.table already communicates this)
  • On or off by default?

e.g.

> options("datatable.print.ncols" = TRUE)
> iris
Key: <Petal.Width>
ncol: 5
     Sepal.Length Sepal.Width Petal.Length Petal.Width   Species
            <num>       <num>        <num>       <num>    <char>
  1:          4.9         3.1          1.5         0.1    setosa
  2:          4.8         3.0          1.4         0.1    setosa
  3:          4.3         3.0          1.1         0.1    setosa
  4:          5.2         4.1          1.5         0.1    setosa
  5:          4.9         3.6          1.4         0.1    setosa
 ---
146:          6.3         3.4          5.6         2.4 virginica
147:          6.7         3.1          5.6         2.4 virginica
148:          6.3         3.3          6.0         2.5 virginica
149:          7.2         3.6          6.1         2.5 virginica
150:          6.7         3.3          5.7         2.5 virginica

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions