[R] keep information on the number of warnings

Luis Borda de Agua lbagua at gmail.com
Thu Jul 31 18:26:23 CEST 2014

I’m using R 3.1.0 in OS X 10.9.4 (Mavericks)

I’m running a function Y that calls a function X which occasionally generates a warning. 
Say that I call the function X 1000 times, and out of these 1000 times I get the following message:

"There were 36 warnings (use warnings() to see them)"

How can I store the number 36 in a variable in function Y?

In other words, how can I extract the information on the number of warnings generated?

Thank you in advance,

Luís Borda de Água

More information about the R-help mailing list