When loading a matrix consisting of 12 columns into R, and then printing it, the terminal window in OS X cuts the matrix in half, sort to speak, first showing all the rows with the initial 7 columns and then showing all the rows again with the remaining 5 columns. However, I would like it to display ll the columns, rather than dividing it up. How can I accomplish this?
Andrie's answer is good, though sometimes one uses a super duper monitor and 9999 is not enough. ;-)
Here's my function for setting the display width:
setWidth <- function (width = NULL)
{
if (is.null(width)) {
columns <- as.numeric(Sys.getenv("COLUMNS"))
if (!is.na(columns)) {
options(width = columns)
}
else {
options(width = 100)
}
}
else {
options(width = width)
}
}
This has been addressed previously, though.
So, to improve on just the changing of width, another trick that I recommend: change the number of digits used in numeric output - set options(digits = ...)
to a smaller value. See ?options
for more info.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With