[R] How do you exit a function in R?
Esmail Bonakdarian
esmail.js at gmail.com
Thu May 29 20:34:02 CEST 2008
Bill Cunliffe wrote:
> For example, based on a certain condition, I may want to exit my code early:
>
>
>
> # Are there the same number of assets in "prices" and
> "positions"?
>
> if (nAssetPositions != nAssetPrices) {
>
> cat("Different number of assets! \n\n")
>
> <exit function>
>
I've wondered about that myself
Have you tried return() ? It would return NULL I think, as long as that
doesn't cause a problem it should exit the method.
More information about the R-help
mailing list