Transform block constructors
Source:R/transform-block.R
, R/transform-head.R
, R/transform-merge.R
, and 2 more
new_transform_block.Rd
Many data transformations are be provided by blocks constructed via
new_transform_block()
, including examples where a single data.frame
is
transformed into another (e.g. subset_block
), and two or more data.frame
s
are combined (e.g. merge_block
or rbind_block
).
Usage
new_transform_block(server, ui, class, ctor = sys.parent(), ...)
new_head_block(n = 6L, direction = c("head", "tail"), ...)
new_merge_block(by = character(), all_x = FALSE, all_y = FALSE, ...)
new_rbind_block(...)
new_subset_block(subset = "", select = "", ...)
Arguments
- server
A function returning
shiny::moduleServer()
- ui
A function with a single argument (
ns
) returning ashiny.tag
- class
Block subclass
- ctor
String-valued constructor name or function/frame number (mostly for internal use or when defining constructors for virtual classes)
- ...
Forwarded to
new_transform_block()
andnew_block()
- n
Number of rows
- direction
Either "head" or "tail"
- by
Column(s) tp join on
- all_x, all_y
Join type, see
base::merge()
- subset, select
Expressions (passed as strings)
Head block
Row-subsetting the first or last n
rows of a data.frame
(as provided by
utils::head()
and utils::tail()
) is implemented as head_block
. This is
an example of a block that takes a single data.frame
as input and produces
a single data.frame
as output.
Merge block
Joining together two data.frame
s, based on a set of index columns, using
base::merge()
is available as merge_block
. Depending on values passed
as all_x
/all_y
the result will correspond to an "inner", "outer", "lfet"
or "right" join. See base::merge()
for details. This block class serves
as an example for a transform block that takes exactly two data inputs x
and y
to produce a single data.frame
as output.
Row-bind block
Row-wise concatenation of an arbitrary number of data.frame
s, as performed
by base::rbind()
is available as an rbind_block
. This mainly serves as
an example for a variadic block via the "special" ...args
block data
argument.
Subset block
This block allows to perform row and column subsetting on data.frame
objects via base::subset()
. Using non-standard evaluation, strings passed
as subset
/select
arguments or entered via shiny UI are turned into
language
objects by base::parse()
.