Warning in R: reached getOption(“max.print”) | How to Increase Limit

 

This page explains how to handle the warning message “reached getOption(“max.print”) — omitted X entries” in the R programming language.

The article will consist of these content blocks:

Let’s dive right into the examples…

 

Example 1: Reproduce Notification: reached getOption(“max.print”)

Example 1 illustrates how to replicate the notification “[ reached getOption(“max.print”) — omitted X entries ]” in the RStudio console.

Let’s assume that we have a very long vector in R and we want to print this vector to the RStudio console:

x <- 1:10000                      # Create long vector
x                                 # Print vector
# ... 993  994  995  996  997  998  999 1000
# [ reached getOption("max.print") -- omitted 9000 entries ]

The warning message “[ reached getOption(“max.print”) — omitted 9000 entries ]” occurred after running the previous R code.

The reason for this is that by default the global options of R cut off outputs after the 1000th entry.

So how can we change this? This is what I’ll explain next!

 

Example 2: Increasing Limit of max.print

Example 2 illustrates how to increase the limit of max.print by changing the global options in R. Have a look at the following R code:

options(max.print = 10000)        # Change global options

Now, let’s print our vector object x once more to the RStudio console:

x                                 # Print vector
# ... 9993  9994  9995  9996  9997  9998  9999 10000

The entire vector object is printed to the RStudio console. Looks great!

Note that the global options are now changed for the whole R session. In case you want to reset these options, you either have to decrease the max.print limit by specifying the default value in the options function or you have to restart R.

 

Video & Further Resources

Would you like to learn more about max.print in R? Then you may want to have a look at the following video of my YouTube channel. In the video, I show the topics of this article:

 

The YouTube video will be added soon.

 

Furthermore, I can recommend to have a look at the related articles that I have published on this website:

 

In summary: In this tutorial you learned how to set the global options to increase the max.print limit in the R programming language. If you have any additional questions, let me know in the comments below.

 

Subscribe to the Statistics Globe Newsletter

Get regular updates on the latest tutorials, offers & news at Statistics Globe.
I hate spam & you may opt out anytime: Privacy Policy.


Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.

Menu
Top