We have seen how we can implement the split-apply-combine approach on a data frame using three lines of code. The plyr
package helps us to implement the approach in one line. Since R has multiple data structures, we need multiple functions to work on different data structures. R has three main data structures: list, array, and data frames. So, there could be three different types of input, and the output could produce three different types of data structures. There could be 3 x 3 = 9
possible input-output combinations, and for this reason, plyr
has 9
functions to incorporate all the input-output combinations. In addition, we have three additional functions that take six different types of input but display only one type of output.
The plyr
package works on every type of data structure, whereas the dplyr
package is designed to work only on data frames. The dplyr
package offers a complete set of functions to perform every kind of data manipulation we...