Debian Codegraph @

man/NS.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/shiny.R
3 \docType{data}
4 \name{NS}
5 \alias{NS}
6 \alias{ns.sep}
7 \title{Namespaced IDs for inputs/outputs}
8 \format{
9 An object of class \code{character} of length 1.
10 }
11 \usage{
12 NS(namespace, id = NULL)
13
14 ns.sep
15 }
16 \arguments{
17 \item{namespace}{The character vector to use for the namespace. This can have
18 any length, though a single element is most common. Length 0 will cause the
19 \code{id} to be returned without a namespace, and length 2 will be
20 interpreted as multiple namespaces, in increasing order of specificity
21 (i.e. starting with the top-level namespace).}
22
23 \item{id}{The id string to be namespaced (optional).}
24 }
25 \value{
26 If \code{id} is missing, returns a function that expects an id string
27 as its only argument and returns that id with the namespace prepended.
28 }
29 \description{
30 The \code{NS} function creates namespaced IDs out of bare IDs, by joining
31 them using \code{ns.sep} as the delimiter. It is intended for use in Shiny
32 modules. See \url{https://shiny.rstudio.com/articles/modules.html}.
33 }
34 \details{
35 Shiny applications use IDs to identify inputs and outputs. These IDs must be
36 unique within an application, as accidentally using the same input/output ID
37 more than once will result in unexpected behavior. The traditional solution
38 for preventing name collisions is \emph{namespaces}; a namespace is to an ID
39 as a directory is to a file. Use the \code{NS} function to turn a bare ID
40 into a namespaced one, by combining them with \code{ns.sep} in between.
41 }
42 \seealso{
43 \url{https://shiny.rstudio.com/articles/modules.html}
44 }
45 \keyword{datasets}