View source: R/transform-block.R
new_transform_block | R Documentation |
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
).
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 = "", ...)
server |
A function returning |
ui |
A function with a single argument ( |
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 |
n |
Number of rows |
direction |
Either "head" or "tail" |
by |
Column(s) tp join on |
all_x , all_y |
Join type, see |
subset , select |
Expressions (passed as strings) |
All blocks constructed via new_transform_block()
inherit from
transform_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.
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-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.
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()
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.