also tryCatch

> tryCatch( warning("a warning"),
+          warning = function(w) {
+            paste("Caught:", conditionMessage( w ))
+          })
[1] "Caught: a warning"
> 



ronggui <[EMAIL PROTECTED]> writes:

> see ?options
>
>  'warn': sets the handling of warning messages.  If 'warn' is
>           negative all warnings are ignored.  If 'warn' is zero (the
>           default) warnings are stored until the top-level function
>           returns.  If fewer than 10 warnings were signalled they will
>           be printed otherwise a message saying how many (max 50) were
>           signalled.  A top-level variable called 'last.warning' is
>           created and can be viewed through the function 'warnings'.
>           If 'warn' is one, warnings are printed as they occur.  If
>           'warn' is two or larger all warnings are turned into errors.
>
>      'warning.expression': an R code expression to be called if a
>           warning is generated, replacing the standard message.  If
>           non-null it is called irrespective of the value of option
>           'warn'.
>
>      'warnings.length': sets the truncation limit for error and warning
>           messages.  A non-negative integer, with allowed values
>           100...8192, default 1000.
>
>
> 2006/3/16, Sigal Blay <[EMAIL PROTECTED]>:
>> Is there any way to store the value of warnings but avoid printing them?
>>
>> A simplified example:
>> > out <- c(0.2,0.3,0.4)
>> > var <- c(2,3,4)
>> > outcome <- glm(out ~ var, family=binomial())
>> Warning message:
>> non-integer #successes in a binomial glm! in: eval(expr, envir, enclos)
>>
>> I don't like the warning printed,
>> but I would like to be able to check it's value after the top-level function
>> has completed and than decide weather to print it or not.
>>
>> Thanks,
>>
>> Sigal Blay
>> Statistical Genetics Working Group
>> Department of Statistics and Actuarial Science
>> Simon Fraser University
>>
>> ______________________________________________
>> [email protected] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>>
>
>
> --
> 黄荣贵
> Deparment of Sociology
> Fudan University
>
> ______________________________________________
> [email protected] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to