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

From: Henrique Dallazuanna <wwwhsd_at_gmail.com>
Date: Thu, 29 May 2008 15:39:44 -0300

Try using stop:

 if (nAssetPositions != nAssetPrices) {

                       stop("Different number of assets! \n\n")

On Thu, May 29, 2008 at 3:23 PM, Bill Cunliffe <bill_at_elevationllc.net> 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.
>

-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

	[[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.

Received on Thu 29 May 2008 - 19:37:55 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 29 May 2008 - 20:32:15 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive