> On 15 Dec 2015, at 13:12 , One Two <twoo872 at gmail.com> wrote:
>
> Hello,
>
> I noticed that the function bquote throws an error if there are
> multiple "==" in the first argument. E.g.
>> txt.main <- bquote(1 == 2 == 3)
> Error: unexpected '==' in "txt.main <- bquote(1 == 2
=="
>
> Is this behaviour intended or is it a bug? Because I don't see a
> reason for this behaviour and didn't find anything in the
> documentation either.
It's a consequence of the grammar of R. At some point, it was decided that a
== b == c would have undesirable semantics[*], so == (and the other relational
operators) became non-associative. It is a basic design feature of plotmath that
it uses unevaluated R expressions, which have to be syntactically valid.
-pd
[*] As in
0 == 1 == 2
0 == (1 == 2)
0 == FALSE
0 == 0
TRUE
(which works from the 2nd line onwards, but then you can be assumed that you
know what you are doing...)
>
> I know that one can use grouping as a workaround like this:
>> txt.main <- bquote({1 == 2} == 3)
> I am rather interested in whether I should file a bug about this
> behaviour or not.
>
> I'm using RStudio in this environment:
>> sessionInfo()
> R version 3.2.3 (2015-12-10)
> Platform: i386-w64-mingw32/i386 (32-bit)
> Running under: Windows 7 (build 7601) Service Pack 1
>
> locale:
> [1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252
> LC_MONETARY=German_Germany.1252
> [4] LC_NUMERIC=C LC_TIME=German_Germany.1252
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
> loaded via a namespace (and not attached):
> [1] tools_3.2.3
>
> Best Regards,
> Martin
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
--
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com