similar to: ?Syntax wrong about `?`'s precedence ?

Displaying 20 results from an estimated 20000 matches similar to: "?Syntax wrong about `?`'s precedence ?"

2019 Aug 30
3
?Syntax wrong about `?`'s precedence ?
Precedence is a property of the parser and has nothing to do with the semantics assigned to various symbols. Using just core R functions you can see the precedence of '?' is between those of '=' and '<-'. > # '=' has lower precedence than '?' > str(as.list(parse(text="a ? b = c")[[1]])) List of 3 $ : symbol = $ : language `?`(a, b) $
2019 Aug 30
1
?Syntax wrong about `?`'s precedence ?
...and 14955, which seems to have the explanation (but was marked as closed/fixed??). The parser does list '?' as lower precedence than '=', but '='-assignments are not normal 'expr's which can appear as arguments to '?'. (Presumably because of named arguments: f(a=b) differs from f(a<-b).) Other tokens which have lower precedence than assignments are
2019 Aug 30
0
?Syntax wrong about `?`'s precedence ?
See also: https://bugs.r-project.org/bugzilla/show_bug.cgi?id=16710 On Fri, Aug 30, 2019 at 9:02 AM William Dunlap via R-devel <r-devel at r-project.org> wrote: > > Precedence is a property of the parser and has nothing to do with the > semantics assigned to various symbols. Using just core R functions you can > see the precedence of '?' is between those of '='
2020 Jan 10
1
Operator precedence of =, <- and ?
The documentation (help("Syntax")) gives the operator precedence of the assignment operators and help, from highest to lowest, as: ?<- <<-? assignment (right to left) ?=? assignment (right to left) ??? help (unary and binary) If I understand correctly this implies that `a = b ? c` and `a <- b ? c` should parse
2014 May 07
2
precedence (was 'historical NA question')
Hadley asked about the Blue book; my shelf still has the earlier brown book Becker and Chambers, 1984, S: An interactive environment for data analysis and graphics. The manual page for precedence is $ component select %x special operator - unary minus : sequence operator ^ ** exponentiation * / mult/div + -
2017 Jun 22
5
Hunting a histogram variant
I'm looking for a histogram variant in which data points are plotted as labelled rectangles 'piled up' to form a histogram. I've posted an example at https://www.dropbox.com/s/ozi8bhdn5kqaufm/labelled_histogram.png?dl=0 It seems to have a long pedigree, as I see it (as in this example) in documents going back beyond the '80s. But I've not seen it in recent textbooks. So it
2017 Jul 20
3
Precision of values > 53 bits
> On 10 Jan 2013, at 15:56 , S Ellison <S.Ellison at lgcgroup.com> wrote: > > > >> I am working with large numbers and identified that R looses >> precision for such high numbers. > Yes. R uses standard 32-bit double precision. Well, for large values of 32... such as 64. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School
2015 Oct 06
5
authorship and citation
> The former co-author contributed, so he is still author and probably copyright > holder and has to be listed among the authors, otherwise it would be a CRAN > policy violation ... It's a bit of a philosophical question right now, but at some point in a developing package's life - particularly one that starts small but is subsequently refactored in growth - there may be no code
2017 Mar 17
2
Support for user defined unary functions
The unquoting discussion is IMHO separate from this proposal and as you noted probably better served by a native operator with different precedence. I think the main benefit to providing user defined prefix operators is it allows package authors to experiment with operator ideas and gauge community interest. The current situation means any novel unary semantics either need to co-opt existing
2017 Mar 17
2
Support for user defined unary functions
>After off list discussions with Jonathan Carrol and with >Michael Lawrence I think it's doable, unambiguous, >and even imo pretty intuitive for an "unquote" operator. For those of us who are not CS/Lisp mavens, what is an "unquote" operator? Can you expression quoting and unquoting in R syntax and show a few examples where is is useful, intuitive, and fits in to
2017 Mar 16
2
Support for user defined unary functions
Gabe, The unary functions have the same precedence as normal SPECIALS (although the new unary forms take precedence over binary SPECIALS). So they are lower precedence than unary + and -. Yes, both of your examples are valid with this patch, here are the results and quoted forms to see the precedence. `%chr%` <- function(x) as.character(x) `%identical%` <- function(x, y)
2018 Nov 30
2
Unexpected argument-matching when some are missing
But the main point is where arguments are mixed together: > debugonce(plot.default) > plot(x=1:10, y=, 'l') ... Browse[2]> missing(y) [1] FALSE Browse[2]> y [1] "l" Browse[2]> type [1] "p" I think that's what I fall over mostly: that named, empty arguments behave entirely different from omitting them (", ,") And I definitely agree we need
2017 Mar 17
2
Support for user defined unary functions
Your example x = 5 exp = parse(text="f(uq(x)) + y +z") # expression: f(uq(x)) +y + z do_unquote(expr) # -> the language object f(5) + y + z could be done with the following wrapper for bquote my_do_unquote <- function(language, envir = parent.frame()) { if (is.expression(language)) { # bquote does not go into expressions, only calls
2017 Mar 17
3
Support for user defined unary functions
I agree there is no reason they _need_ to be the same precedence, but I think SPECIALS are already have the proper precedence for both unary and binary calls. Namely higher than all the binary operators (except for `:`), but lower than the other unary operators. Even if we gave unary specials their own precedence I think it would end up in the same place. `%l%` <- function(x) tail(x, n =
2018 Nov 29
2
Unexpected argument-matching when some are missing
On Thu, Nov 29, 2018 at 1:10 PM S Ellison <S.Ellison at lgcgroup.com> wrote: > > > > > plot(x=1:10, y=) > > > plot(x=1:10, y=, 10:1) > > > > > > In both cases, 'y=' is ignored. In the first, the plot is for y=NULL (so not > > 'missing' y) > > > In the second case, 10:1 is positionally matched to y despite the
2017 Aug 04
2
Latin hypercube sampling from a non-uniform distribution
Hello, I am performing a sensitivity analysis using a Latin Hypercube sampling. However, I have difficulty to draw a Hypercube sample for one variable. I?ve generated this variable from a Poisson distribution as follows: set.seed(5) mortality_probability <- round(ppois(seq(0, 7, by = 1), lambda = 0.9), 2) barplot(mortality_probability, names.arg = seq(0, 7, by = 1), xlab = "Age
2011 Sep 14
2
Question regarding dnorm()
Hi, I have one basic doubt. Suppose X ~ N(50,10). I need to calculate Probability X = 50. dnorm(50, 50, 10) gives me [1] 0.03989423 My understanding is (which is bit statistical or may be mathematical) on a continuous scale, Probability of the type P(X = .....) are nothing but 1/Infinity i.e. = 0. So as per my understanding P(X = 50) should be 0, but even excel also gives 0.03989422. Obviously
2017 Mar 16
2
Support for user defined unary functions
I guess this would establish a separate "namespace" of symbolic prefix operators, %*% being an example in the infix case. So you could have stuff like %?%, but for non-symbolic (spelled out stuff like %foo%), it's hard to see the advantage vs. foo(x). Those examples you mention should probably be addressed (eventually) in the core language, and it looks like people are already able
2017 Mar 16
2
Support for user defined unary functions
Martin, Jim can speak directly to his motivations; I don't claim to be able to do so. That said, I suspect this is related to a conversation on twitter about wanting an infix "unquote" operator in the context of the non-standard evaluation framework Hadley Wickham and Lionel Henry (and possibly others) are working on. They're currently using !!! and !! for things related to
2010 Jun 03
2
[LLVMdev] [PATCH] docs/tutorial/ Kaleidoscope typos
Index: docs/tutorial/LangImpl6.html =================================================================== --- docs/tutorial/LangImpl6.html (revision 105365) +++ docs/tutorial/LangImpl6.html (working copy) @@ -531,7 +531,7 @@ def unary-(v) 0-v; -# Define &gt; with the same precedence as &gt;. +# Define &gt; with the same precedence as &lt;. def binary&gt; 10 (LHS RHS)