| add_count.trackr_df | R Documentation |
See dplyr::mutate(), dplyr::add_count(), dplyr::add_tally(),
dplyr::transmute(), dplyr::select(), dplyr::relocate(),
dplyr::rename() dplyr::rename_with(), dplyr::arrange() for more details
on underlying functions. dtrackr provides equivalent functions for
mutating, selecting and renaming a data set which act in the same way as
dplyr. mutate / select / rename generally don't add anything in terms
of provenance of data so the default behaviour is to miss these out of the
dtrackr history. This can be overridden with the .messages, or
.headline values in which case they behave just like a comment().
## S3 method for class 'trackr_df'
add_count(x, ..., .messages = "", .headline = "", .tag = NULL)
the .data dataframe after being modified by the dplyr equivalent
function, but with the history graph updated with a new stage if the
.messages or .headline parameter is not empty.
dplyr::add_count()
library(dplyr)
library(dtrackr)
# mutate and other functions are unitary operations that generally change
# the structure but not size of a dataframe. In dtrackr these are by ignored
# by default but we can change that so that their behaviour is obvious.
# add_count
# adding in a count or tally column as a new column
iris %>%
track() %>%
add_count(Species, name="new_count_total",
.messages="{.new_cols}",
# .messages="{.cols}",
.headline="New columns from add_count:") %>%
history()
# add_tally
iris %>%
track() %>%
group_by(Species) %>%
dtrackr::add_tally(wt=Petal.Length, name="new_tally_total",
.messages="{.new_cols}",
.headline="New columns from add_tally:") %>%
history()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.