A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/rstudio/shinymeta/wiki/Syntax-changes-for-shinymeta-0.2.0 below:

Syntax changes for shinymeta 0.2.0 · rstudio/shinymeta Wiki · GitHub

In shinymeta 0.2.0, we made a very significant breaking change to the syntax you use to annotate code in meta reactive objects.

I'm very sorry we made this change after making shinymeta public, and after I even gave a talk about it at the useR2019 conference. It was only through user feedback that we realized what a severe problem the previous syntax had.

When shinymeta was initially made public, you would use the !! (pronounced "bang-bang") operator. Like so:

# Obsolete shinymeta 0.1.0 syntax
r <- metaReactive({
  head(data(), !!input$nrow)
})

The effect of this !! was as follows:

With shinymeta 0.2.0, the ..() (pronounced "dot-dot") function is used instead:

r <- metaReactive({
  head(data(), ..(input$nrow))
})

The effect of ..() is very subtly different.

There were several issues with the old syntax:

  1. The !! operator had too many jobs. Its original purpose is for unquoting with tidyeval-aware packages like dplyr, and then we added unquoting for shinymeta. Because these two usages were so similar, and both built on top of tidyeval (at the time), I thought we could get away with using the same !! operator for both; but it doesn't work. The upshot was that using !! for shinymeta purposes made it nearly impossible to also use !! for dplyr purposes in the same app. With a dedicated ..() syntax for shinymeta, we no longer have this ambiguity.

  2. The behavior of !! in 0.1.0 was to replace the unquoted expression with its value--for example, print(!!letters[1:5]) would become print(c("a", "b", "c", "d", "e")). This is only correct if the code in question displays referential transparency, but R has many functions that use non-standard evaluation in ways that are not at all referentially transparent. For example, the plot function determines its default axes labels based on NSE, and lm does something similar. This problem was pointed out by @zappingseb in Issue #53, where shinymeta unquoting caused lm output to look like garbage.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4