Hello again,

Let say I have following user defined function:

Myfn <- function(x) {
if (x < 0) {
warning("Negative value")
}
return(x)
}

Now I want to create some function which will save the Warnings from
'Myfn', so that I can use those warnings later for more analysis. Therefore
I was thinking of following type of function:

ProposedWarningStoreFunction <- function() {
                  .........            ............        ...........
}

therefore,if I run 'ProposedWarningStoreFunction', I should get following
kind of results:

Warnings <- ProposedWarningStoreFunction({Result <- Myfn(-4)})

> Result
 -4

> Warnings
In Myfn(-3) : Negative value

Can somebody here point me how to achieve this? Or is it possible to
achieve at all?

Thank you for your help.

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to