Option to print the number of columns

Open
#6,663 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
r
Domain
data

Research direction

Start with data.table:::print.data.table and compare its existing nrows handling. Review the issue's proposed parameter, option, label, placement, zero-row behavior, and default as decisions to resolve before implementation. Done means the agreed option prints the column count consistently without changing output when disabled.

Written by the indexing model from the issue text.

Description

print

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
Dominant language
R
Stars
3.9k
Forks
1.1k
Avg merge
14h 4m
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Rdatatable/data.table

All issues in Rdatatable/data.table

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.