I have a data frame with 72 columns and 409 rows which is called: spect
The problem: print(spect) does not display the whole data frame. When i scroll to the top of the console i see the following:
96 NA NA 2 NA NA NA
97 NA NA 2 NA NA NA
98 NA NA 1 0 NA NA
The problem with the output displayed above is that i dont see the variables, and the rows start at nr. 96.
However when I ask R to display a subset, say print(spect[,1:3]) i get the expected result:
print(spect[,1:3]) idnr gender age 1 1 kvinde 22.07671 2 2 kvinde 32.46575 3 3 kvinde 19.72055 4 4 mand 19.95617
Also, when i write fix(spect) the editor opens with expected correct result.
Also, when i do calculations on the data it seems to work properly.
I dont have this problem with smaller dataframes with approximately 30 variables.
I dont get an error message.
max.print is
getOption(“max.print”)
[1] 99999
But the console has no-where near that maximum, in fact it shows only about 2000 rows. I get the same error after restarting my computer and R, and removing all objects and press “control + l” to clear the console.
So is this just a bug in R or am i missing something?
I assume that you are sitting in a Unix (Linux, MacOS) terminal. The terminal has a limit of how many lines you can scroll back, and you need to change this limit to be able to see everything. Below is a screenshot from options of the
gnome-terminalshowing a checkbox for unlimited scroll-back history:The max.print option only influences the number of items printed. It hits you only when you see the following (or similar) message at the end (bottom) of your output:
That said, in most of the cases it is unnecessary and unpractical to view large data frames by scrolling the terminal. Usually, one is interested in some particular rows, and one tries to select these rows. Or one inspects it chunk by chunk:
etc. Or, one attempts to achieve a satisfying graphical representation of the data.