In shinymeta, ..() is designed for annotating portions of code inside a metaExpr (or its higher-level friends metaReactive, metaObserve, and metaRender). At run time, these meta- functions search for ..() calls and replace them with something else (see Details). Outside of these meta- functions, ..() is not defined, so one must take extra care when interrogating any code within a meta- function that contains ..() (see Debugging).




A single code expression. Required.


expr, but annotated.


As discussed in the Code Generation vignette, ..() is used to mark reactive reads and unquote expressions inside metaExpr (or its higher-level friends metaReactive, metaObserve, and metaRender). The actual behavior of ..() depends on the current mode of execution:

  • Normal execution: the ..() call is stripped from the expression before evaluation. For example, ..(dataset()) becomes dataset(), and ..(format(Sys.Date())) becomes format(Sys.Date()).

  • Meta execution (as in expandChain()): reactive reads are replaced with a suitable name or value (i.e. ..(dataset()) becomes dataset or similar) and other code is replaced with its result (..(format(Sys.Date())) becomes e.g. "2019-08-06").


If ..() is called in a context where it isn't defined (that is, outside of a meta-expression), you'll see an error like: "..() is only defined inside shinymeta meta-expressions". In practice, this problem can manifest itself in at least 3 different ways:

  1. Execution is halted, perhaps by inserting browser(), and from inside the Browse> prompt, ..() is called directly. This is also not allowed, because the purpose of ..() is to be searched-and-replaced away before metaExpr begins executing the code. As a result, if you want to interrogate code that contains ..() at the Browse> prompt, make sure it's wrapped in metaExpr before evaluating it. Also, note that when stepping through a metaExpr at the Browse> prompt with n, the debugger will echo the actual code that's evaluated during normal execution (i.e., ..() is stripped), so that's another option for interrogating what happens during normal execution. On the other hand, if you are wanting to interrogate what happens during meta-execution, you can wrap a metaExpr with expandChain().

  2. ..() is used in a non-metaExpr portions of metaReactive2, metaObserve2, and metaRender2. As discussed in The execution model, non-metaExpr portions of -2 variants always use normal execution and are completely ignored at code generation time, so ..() isn't needed in this context.

  3. Crafted a bit of code that uses ..() in a way that was too clever for shinymeta to understand. For example, lapply(1:5, ..) is syntactically valid R code, but it's nonsense from a shinymeta perspective.

See also