amplify {nestr} | R Documentation |
Amplify the data frame with a given structure
Description
The dplyr::mutate
function modifies, deletes or creates a new column for
a data frame without altering the number of rows. The amplify
function
can create new columns which generally increase (or amplify) the size of the
row dimension. The observations in other columns are duplicated.
Usage
amplify(.data, ...)
## S3 method for class 'data.frame'
amplify(
.data,
...,
.keep = c("all", "used", "unused", "none"),
.before = NULL,
.after = NULL
)
Arguments
.data |
An object with the data. |
... |
Name-value pairs. |
.keep , .before , .after |
Use to control which columns are retained and how it is ordered
in the output. See documentation of |
Details
If you are familiar with gene replication process then you can recall these functions in genetic terms; an amplified gene is a duplication of the original while a mutated gene modifies the original state.
Value
Returns a data frame.
Examples
df <- data.frame(x = 1:3, y = c("a", "b", "b"))
amplify(df, z = nest_in(y, "a" ~ 5,
"b" ~ 3))
[Package nestr version 0.1.2 Index]