[R] stopifnot message mutation

Vadim Organovich vogranovich at jumptrading.com
Fri Aug 15 22:10:45 CEST 2008


Thank you very much Charles!

I probably should stop passing the dots to subfunctions and rather doctor the results of as.list(match.call()), e.g.

mc <- as.list(match.call())
mc[[1]] <- stopifnot
eval(as.call(mc))

This looks safer.

Thanks again,
Vadim

________________________________________
From: Charles C. Berry [cberry at tajo.ucsd.edu]
Sent: Friday, August 15, 2008 2:27 PM
To: Vadim Organovich
Cc: r-help at r-project.org
Subject: Re: [R] stopifnot message mutation

On Fri, 15 Aug 2008, Vadim Organovich wrote:

> Dear R-users,
>
> Could someone please explain why the message printed by function stopifnot2, see below, is different from that of stopifnot itself?


Refer to the source

        page(stopifnot,'print')

Then consider this:

> foo <- function(...) match.call()
> foo2 <- function(...) foo(...)
> foo(a+b)[[2]]
a + b
> foo2(a+b)[[2]]
..1
>


HTH,

Chuck


>
> Thank you for your help,
> Vadim
>
>
>> stopifnot2 <- function(...) stopifnot(...)
>> stopifnot(F)
> Error: F is not TRUE
>> stopifnot2(F)
> Error: ..1 is not TRUE
>
>> version
>               _
> platform       i386-pc-mingw32
> arch           i386
> os             mingw32
> system         i386, mingw32
> status
> major          2
> minor          6.1
> year           2007
> month          11
> day            26
> svn rev        43537
> language       R
> version.string R version 2.6.1 (2007-11-26)
>
> Note: This email is for the confidential use of the named addressee(s) only and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you are hereby notified that any review, dissemination or copying of this email is strictly prohibited, and to please notify the sender immediately and destroy this email and any attachments.  Email transmission cannot be guaranteed to be secure or error-free.  Jump Trading, therefore, does not make any guarantees as to the completeness or accuracy of this email or any attachments.  This email is for informational purposes only and does not constitute a recommendation, offer, request or solicitation of any kind to buy, sell, subscribe, redeem or perform any type of transaction of a financial product.
>
> ______________________________________________
> 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

Note: This email is for the confidential use of the named addressee(s) only and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you are hereby notified that any review, dissemination or copying of this email is strictly prohibited, and to please notify the sender immediately and destroy this email and any attachments.  Email transmission cannot be guaranteed to be secure or error-free.  Jump Trading, therefore, does not make any guarantees as to the completeness or accuracy of this email or any attachments.  This email is for informational purposes only and does not constitute a recommendation, offer, request or solicitation of any kind to buy, sell, subscribe, redeem or perform any type of transaction of a financial product.



More information about the R-help mailing list