There's more…

In this recipe, you went through the implementation using the dplyr approach and the base R approach. Though the outputs are same, if you notice the column name of the output, there is a difference between the approaches. This is one of the limitations of using the aggregate function. It usually treats all columns under the same name irrespective of the name you define in the customized function. As a result, the column name comes with an x prefix, whereas in the dplyr approach, the column name comes as you defined it within the body of the code.

Moreover, the output of the dplyr approach looks cleaner compared to the base R approach.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset