May 2019
Beginner to intermediate
266 pages
5h 57m
English
The mutate() function is used to add new columns to the dataset mentioned. It is considered useful to create attributes with respect to functions of other attributes in the dataset. The mutate() function is regarded as one of the essential tools for new feature creation, especially during the data preprocessing stage.
We have numeric columns in our dataset. Consider a scenario where we have to create a column to calculate the displacement and number of cylinders used for covering a certain distance. We can implement the mutate() function to achieve this:
> mpgMutate <- mpg %>% mutate(nv=cyl+displ) > View(mpgMutate)
The output with the new value of the nv attribute is displayed as follows, and includes a summation of ...
Read now
Unlock full access