You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The bug is an observation that all the column names are printed out for a matrix. This is not a desirable behavior for printing large matrices, for example, in print(matrix(1:3000, nrow=2), all the 1500 columns names ([,1] [,2], ...[,1499] [,1500]) are printed.
This problem also happens in data frames where cbind(iris, iris, iris) will print out all the 15 columns, rather than doing some shrinkage.
Following the discussion in the link by @gmbecker, one thing to notice is that the discussion here is on the print of the columns name rather than the entry:
print(matrix(nrow = 100, ncol = 4), max = 5) will print 4 column names: [,1] [,2] [,3] [,4] and 4 entries of NA
print(matrix(nrow = 100, ncol = 20), max = 5) will print all the 20 column names and no entries
In the source code of print.data.frame(), the argument max gets the option max.print if it is NULL. It controls the number of entries get printed and has the behaviour that if the maximum number of entries allowed does not constitute a full row, no entry is printed (This explains why the first dot point prints out the NAs but the second one doesn't). @elinw has linked the source code for this.
The width argument in print() controls the width of the output, but still prints out all the column names.
https://bugs.r-project.org/show_bug.cgi?id=15027
Some analysis already done by @elinw.
The text was updated successfully, but these errors were encountered: