Implicit Transformation

At times the data transformations we wish to perform involve applying the same transformations to multiple columns. Implicit transformation allows us to succinctly apply one or more data transformation expressions to a selected set of columns without having to spell out each transformation explicitly.

A typical implicit data transformation expression looks like so:

df_2 = df %>%
  mutate(across(
    where(is.double) & !c(col_1, col_2), round))

where the construct mutate(across(cols, fun)) allows us to succinctly apply a data transformation operation fun to one or more columns cols without repeating code.

This section is organized to cover the aspects of implicit data transformation as follows:

  1. Column Selection where we cover how to select the column(s) to each of which we will apply transformation operations.
  2. Function Specification where we cover how to specify the data transformation expressions or functions to apply to each of the selected columns.
  3. Output Naming where we cover how to specify the name(s) of output column(s) created by the implicit data transformation operations.
  4. Grouped Transformation where we extend the practice of implicit data transformation to grouped data transformation operations.
R
I/O