dataSubsetServer | R Documentation |
Create a reactive subsetted dataset based on user selection
dataSubsetServer(
id,
dataset,
subsetv,
subsets = NULL,
customdata = NULL,
informd = NULL
)
id |
Character ID for specifying namespace, see |
dataset |
A |
subsetv |
Name of the subset-by variable in the data. |
subsets |
Optional, a list to display groups with higher-level grouping in the selection.
By default, the selection is composed of unique values in |
customdata |
Optional, a length-one character vector of data column to append. See details. |
informd |
Relative path to the Rmarkdown file, whose contents will be displayed in the modal. |
This modularizes the usual means of subsetting data by selecting group(s) in a variable.
There can be several of these modules to create subsets from the same dataset,
e.g. two modules with different grouping variables given to subsetv
,
or to create subsets from different datasets.
The only potentially interesting extra option is customdata
,
which appends a column to the subsetted result and exists for different purposes.
When there are several instances of the module for creating subsets from different datasets,
appending a customdata
column could be useful to track the dataset origin of the subset,
especially if the subset data are to be merged with other data into one dataset later on.
For example, for two datasets that come from different sources,
customdata
can be passed in as c(Source="S1")
for the first module
and c(Source="S2")
for the second.
Alternatively, customdata
can be useful for appending custom data
such as c(Color="red")
, perhaps to use in plotting of the subsetted data.
Note: currently, multi-selection is a non-configurable default.
A reactive data.table
representing a subset of dataset
.
Other dataSubset functions:
dataSubsetInput()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.