mutate() {.build}

The mutate() verb, unlike the ones covered so far, creates new variable(s) i.e. new column(s). For example

`r dataframe_name %>%mutate(new_col = sqrt(r colnames(df_numeric_select))) %>%head(1)`

The code chunk above takes all the elements of the column r colnames(df_numeric_select), evaluates the square root of each element, and populates a new column called new_col with these results

Try mutate() to make a new column

`r dataframe_name %>%mutate(new_col = sqrt(r colnames(df_numeric_select))) %>%head(3)`




matthewhirschey/bespokelearnr documentation built on Oct. 11, 2020, 12:57 a.m.