#RStats #DataScience #Programming
#RStats #DataScience #Programming
Keeps only the newly created variables.
df %>% mutate(new_var = x + y, .keep = "none")
Only new_var is retained. This option is great for isolating the results of your mutations.
Keeps only the newly created variables.
df %>% mutate(new_var = x + y, .keep = "none")
Only new_var is retained. This option is great for isolating the results of your mutations.
Keeps only variables not used in the mutation.
df %>% mutate(new_var = x + y, .keep = "unused")
All columns except x and y are kept, along with new_var. Useful when you want to exclude variables involved in the mutation.
Keeps only variables not used in the mutation.
df %>% mutate(new_var = x + y, .keep = "unused")
All columns except x and y are kept, along with new_var. Useful when you want to exclude variables involved in the mutation.
Keeps only variables used in the mutation and the new ones.
df %>% mutate(new_var = x + y, .keep = "used")
Only x, y, and new_var are kept. Unused columns are dropped, reducing clutter!
Keeps only variables used in the mutation and the new ones.
df %>% mutate(new_var = x + y, .keep = "used")
Only x, y, and new_var are kept. Unused columns are dropped, reducing clutter!
Keeps all existing variables alongside the new ones.
df %>% mutate(new_var = x + y, .keep = "all")
All columns in df are retained, plus new_var. This is the default behavior.
Keeps all existing variables alongside the new ones.
df %>% mutate(new_var = x + y, .keep = "all")
All columns in df are retained, plus new_var. This is the default behavior.