Skip to content

Bug 15027 - max.print is ignored for matrix headers #4

@hturner

Description

@hturner

This bug was analysed by @huizezhang-sherry and @gmbecker and the Bug BBQ in 2024 and also by @elinw on the original bug report.

I think a potential solution would be to avoid printing the column headers from matrices/data.frames when all rows are omitted due to the max argument or the max.print option. This is consistent with the behaviour for arrays, e.g.

``` r
print(array(dim= c(6, 6, 6)), max =5)
#>  [ reached getOption("max.print") -- omitted 6 matrix slice(s) ]
```

(Note the message is misleading here, see #3).

According to ?print.data.frame, this function

formats the data frame column-by-column, then converts to a character matrix and dispatches to the print method for matrices.

So, without digging too deep, I think a fix for both cases might be implemented by modifying the C function printMatrix, e.g. changing the logic to skip printing the matrix and just print the message when there are zero rows.

Potential a good issue for someone new to working on C code in base R.

Metadata

Metadata

Labels

AssignedIssue has been assigned to 1 or more contributorsCIssues requiring knowledge of CHutch 2024Issues reserved for R Dev Day @ Hutch 2024I/OIssues related to the input/output systemneeds patchImplement the agreed fix and prepare a patch for review

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions