tplyr_layer | R Documentation |
tplyr_layer
objectThis object is the workhorse of the tplyr
package. A
tplyr_layer
can be thought of as a block, or "layer" of a table.
Summary tables typically consist of different sections that require different
summaries. When programming these section, your code will create different
layers that need to be stacked or merged together. A tplyr_layer
is
the container for those isolated building blocks.
When building the tplyr_table
, each layer will execute independently.
When all of the data processing has completed, the layers are brought
together to construct the output.
tplyr_layer
objects are not created directly, but are rather created
using the layer constructor functions group_count
,
group_desc
, and group_shift
.
tplyr_layer(parent, target_var, by, where, type, ...)
parent |
|
target_var |
Symbol. Required, The variable name on which the summary is to be performed. Must be a variable within the target dataset. Enter unquoted - i.e. target_var = AEBODSYS. |
by |
A string, a variable name, or a list of variable names supplied
using |
where |
Call. Filter logic used to subset the target data when performing a summary. |
type |
"count", "desc", or "shift". Required. The category of layer - either "counts" for categorical counts, "desc" for descriptive statistics, or "shift" for shift table counts |
... |
Additional arguments |
A tplyr_layer
environment that is a child of the specified
parent. The environment contains the object as listed below.
tplyr_layer
Core Object Structuretype
This is an attribute. A string indicating the layer type, which controls the summary that will be performed.
target_var
A quosure of a name, which is the variable on which a summary will be performed.
by
A list of quosures representing either text labels or variable names used in grouping. Variable names must exist within the target dataset Text strings submitted do not need to exist in the target dataset.
cols
A list of quosures used to determine the variables that are used to display in columns.
where
A quosure of a call that containers the
filter logic used to subset the target dataset. This filtering is in
addition to any subsetting done based on where
criteria specified in
tplyr_table
layers
A list with class
tplyr_layer_container
. Initialized as empty, but serves as the
container for any sublayers of the current layer. Used internally.
Different layer types will have some different bindings specific to that layer's needs.
tplyr_table
tab <- tplyr_table(iris, Sepal.Width)
l <- group_count(tab, by=vars('Label Text', Species),
target_var=Species, where= Sepal.Width < 5.5,
cols = Species)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.