[R] How do you exit a function in R?

Charles C. Berry cberry at tajo.ucsd.edu
Thu May 29 20:48:46 CEST 2008


See

 	?return

HTH,

Chuck


On Thu, 29 May 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 have searched, but not found, a way of forcing a function to exit.  Any
> help greatly appreciated.
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>

Charles C. Berry                            (858) 534-2098
                                             Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu	            UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901



More information about the R-help mailing list