R warnings as errors

Apparently you can change the way R handles warnings with the “warn” option, which is quite handy for debugging.

It can have the following values:


< 0 : warnings are ignored
0 : warnings are stored and printed after top-level function has completed
1 : warnings are printed as they occur
2 : warnings are turned into errors

To get and set the value:


getOption('warn')
options(warn=2)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s