9

Several questions about the two R-language tags: and , which are synonymous.

  1. Which of the two should be defined as an alias of which? [nse]-> [non-standard-evaluation] or [non-standard-evaluation] -> [nse] ?
    • Recommendation: 'non-standard-evaluation' should be the main topic name, 'nse' should be the alias to it. Hence, [nse] -> [non-standard-evaluation].
    • Reasoning: a) few beginner users know the acronym 'nse', and outside R it's unheard-of, so likely to result in acronym collision. In fact, collides with 'Nmap Scripting Engine' (Linux cross-platform command-line network security scanner and exploration tool), which should be using its own tag
    • b) no new R users will relate 'nse' to "Why did my dplyr/data.table/ggplot/etc. function call not work?"
  2. There is also a tag , which is the antonym. I'm not making a recommendation about what to do with it (merge/leave separate). Your thoughts?
  3. Last, needs a (draft) topic definition.
    • What packages does this concept occur in: dplyr, magrittr, tidyverse, data.table, ggplot, seplyr, lazyeval, what else? Do we just say "in some R packages...?"
    • Please reply with suggested draft topic definition. I couldn't come up with one, it's quite tricky to write one both succinct and general, and also accessible to new-users. I looked at a few articles 1, 2, 3 etc. and they aren't either succinct or accessible to new users.
13
  • 2
    There are a couple of cases where the [nse] tag is being used to mean something else. Apparently it has something to do with nmap? 1, 2, and 3 (which I retagged before I saw the others). Anyone know what nmap is and can help disambiguate? Aside from this, agreed, this merge needs to happen; the tag should become [non-standard-evaluation]. Mar 23, 2019 at 3:17
  • @CodyGray: oh. Never heard of it. 'nmap' (a Linux cross-platform command-line network security scanner and exploration tool) already has its own tag, and 'NSE' meaning 'Nmap Scripting Engine' seems clearly a reference to [nmap] and should be retagged as such, remove [nse].
    – smci
    Mar 23, 2019 at 3:22
  • @CodyGray: long-overdue making the 'non-standard-evaluation' merge happen. Q2: what to do with standard-evaluation Q3: if you're brave, hazard a draft of the topic definition...
    – smci
    Mar 23, 2019 at 3:23
  • Why do we need to do anything with [standard-evaluation]? These seem like separate concepts to me. Do you not think so? And I can't write a topic definition, because I don't know anything about the subject matter. All I have is a magic button that allows me to merge and synonymize tags. Mar 23, 2019 at 3:27
  • @CodyGray: I didn't say we should (other than obvioously the topic def. for S-E should reference the topic N-S-E, and vice versa, if they stay separate). FYI often users are using them near-synonymously.
    – smci
    Mar 23, 2019 at 3:30
  • Non-standard evaluation can't be described in an accessible way to new users. Doing that would require that they have an understanding of how evaluation of function arguments works in R (and what an expression and a promise are) and I believe only quite advanced users have that. If you are not advanced enough to understand section 4.3.3 of the language deinition, the best description of NSE is simply "magic".
    – Roland
    Mar 25, 2019 at 7:28
  • @C'mon Roland that's nonsense, also needlessly condescending. Here's one attempt to start the ball rolling: "Standard Evaluation means interpreting function arguments as variable or dataframe column names, interpreted immediately at the time the function call is constructed, and only on objects within the scope of that function. NSE allows parameterizing and referencing objects, variables, columns, function calls, expressions, and with that interpretation deferred until late as possible." I'm sure you can do better (in one paragraph), so please post us yours.
    – smci
    Mar 25, 2019 at 7:39
  • A new user does not know what a function call or scope is. Also, I don't think what you write there is entirely correct ("interpreted immediately at the time the function call is constructed"?). Anyway, NSE is anything that accesses (for later evaluation) the expression from the promise before it is forced.
    – Roland
    Mar 25, 2019 at 7:58
  • @Roland, fine, write a better definition, please go ahead. A one-line example illustrating the difference is "With SE f(a,b,c), a,b,c are literal variable/column names. Whereas with NSE, f(...) can contain arbitrary other code which gets evaluated later; we could reference variables or columns that don't yet exist, or call functions which aren't yet defined, etc." How's that? Probably best not to mention promise, scope in the first paragraph, the one users will see on mouseover. You can mention the more complex concepts in later paragraphs, or by reference using URL.
    – smci
    Mar 25, 2019 at 8:07
  • To me [nse] should be the main tag, and [non-standard-evaluation] should be a synonym. Anyone heard/read about non-standard-evaluation would already know what nse means, and is already not not a beginner. Also, I prefer short tags.
    – zx8754
    Mar 25, 2019 at 9:21
  • @zx8754 Short tags lead to collisions, abbreviation should be avoided. (An example for nse has already been established above).
    – Bergi
    Mar 25, 2019 at 20:55
  • @smci Yes, exactly. (I was actually referring to the Nmap Scripting Engine that you had mentioned).
    – Bergi
    Mar 25, 2019 at 22:29

1 Answer 1

1

As somebody who regularly seeks out questions to answer, I want to share several thoughts on the topic:

  • I routinely untag from questions about the "(Indian) National Stock Exchange" (Ex1, Ex2). I think that if one of the aliasing makes this issue less likely to happen, that should be the preferred one.

  • While base R has some NSE capability, this particular feature of the language has been substantially improved upon and popularized by the rlang package, which underlies the immensely popular "tidyverse" packages like dplyr and ggplot2. I don't know the full provenance of the term "non-standard evaluation", but simple Google search reveals that it almost exclusively gets used in the context of "tidyverse". The help page for the base R functions that deal with NSE (quote() and substitute()) do not use the term "non-standard evaluation".

    • If "non-standard evaluation" was coined by the tidyverse developers, then I feel like we should get their input on what to do with the tags. To make things more complicated, they have recently taken to using in place of NSE, as evidenced by their recent guide on the topic.
  • NSE really falls under the umbrella of , and it might be worth to establish some form of cross-reference between the two topics.

  • I disagree with the sentiment that NSE cannot be described to new programmers in accessible terms. While it is certainly an advanced topic, at its core the feature is centered around unevaluated expressions. These expressions do not necessarily need to exist in the context of functions and data frames (although, that's where they are most useful). So, a simple topic description might be:

Non-Standard Evaluation (NSE) is a form of that deals with creation and modification of unevaluated expressions in . By delaying the evaluation of an expression, programmers can reference variables and functions that may not yet exist when the expression is first created. This allows for precise definition of data manipulation before any data is even available. Unevaluated expressions can be freely transferred from one context to another (e.g., passed to a function) and the eventual evaluation requires that all variables referenced by the expression have been defined in the context where the evaluation takes place.

16
  • Thanks a lot for the answer. Want to take a stab at the topic definition? I offered a draft one above, can you improve on it? Yes it's still to suggest we can't have a basic working defn accessible to new-users.
    – smci
    Jul 22, 2019 at 21:21
  • (I wasn't aware 'NSE' was occasionally misapplied to "(Indian) National Stock Exchange" and it isn't really the issue here... just manually untag, and leave a comment to the poster if a repeat offender)
    – smci
    Jul 22, 2019 at 21:22
  • @smci Yes, happy to take a stab. Where should I post it? The nse tag description? Jul 22, 2019 at 21:32
  • Yes. The first paragraph (topic-wiki) should be concise and self-contained; one or two references to accepted definitions are useful. Any longer discussion, with further references etc., goes in subsequent paragraphs. Also, if this is not purely an R term, then the topic wiki should acknolwedge that.
    – smci
    Jul 22, 2019 at 21:35
  • @smci OK, take a look. I looked at several other tags to use as a template. Hopefully, you can see my proposed text, as it's currently under peer review. Jul 23, 2019 at 1:37
  • 1
    Proposed wiki excerpt and Proposed tag wiki Jul 23, 2019 at 1:39
  • I asked above whether this is purely an R term, if not we should preamble with "In R, NSE means..."
    – smci
    Jul 23, 2019 at 1:41
  • Thanks. "This tag covers questions about..." is redundant. I suggested above something like "In R, Standard Evaluation means interpreting function arguments as variable or dataframe column names, interpreted immediately at the time the function call is constructed, and only on objects within the scope of that function. NSE allows parameterizing and referencing objects, variables, columns, function calls, expressions, all with deferred interpretation." That's more concrete than "the creation and manipulation of unevaluated expressions"...
    – smci
    Jul 23, 2019 at 1:43
  • To the best of my knowledge, NSE gets used exclusively in the context of R. In other languages, the predominant term for code manipulating code is metaprogramming. Jul 23, 2019 at 1:44
  • ...which doesn't explicitly reference variables, functions, objects etc.
    – smci
    Jul 23, 2019 at 1:45
  • Well, "This tag covers questions..." was inspired by the dplyr excerpt. :P Jul 23, 2019 at 1:45
  • My understanding is that the excerpt defines the scope of the tag, while the wiki goes into more detail about what the term means. (Another example: data.table) Jul 23, 2019 at 1:47
  • 1
    I think there's also a tendency to lump NSE together with functions / columns / data frames / etc. (probably due to its extensive usage in dplyr). However, standard vs. non-standard evaluation are completely orthogonal to those. Example SE: x <- 1+1, where the expression 1+1 is evaluated immediately in the global context. Example NSE: x <- quote(1+1) captures the expression 1+1 for delayed evaluation. Note that 1+1 doesn't reference any columns, functions or variables, so I think the more general "creation and manipulation of unevaluated expression" is appropriate. Jul 23, 2019 at 2:11
  • Sure, but why not write something accessible to new users? This is a wiki, not a reference or spec. x <- y + 1 is a good example which illustrates delayed evaluation. x <- 1+1 is a silly example, because its result won't differ regardless when, or in which scope, it's evaluated.
    – smci
    Jul 23, 2019 at 3:09
  • @smci: I'm not using 1+1 in the wiki; I'm using the example here to delineate the definition of NSE from its usage. "Creation and manipulation of unevaluated expressions" describes what NSE is. "NSE allows parameterizing and referencing objects, variables, ... all with deferred interpretation" describes what NSE is used for. All the tags I looked at begin with an explicit definition: "R is...", "tidyverse is...", "The R dplyr package is...". I do agree that it's useful for new users to known what NSE may be used for, so I added a summary sentence. Jul 23, 2019 at 14:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .