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
mutate()
to make a new column`r dataframe_name
%>%mutate(new_col = sqrt(
r colnames(df_numeric_select)
)) %>%head(3)`
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.