concept several example in category R

appears as: Several examples
Exploring Data with R

This is an excerpt from Manning's book Exploring Data with R.

To get summary statistics across a set of groups we can use group_by() in conjunction with summarize(). The summarize() works a lot like mutate() in that we can provide a new column name and a statement for its calculation. We can use several different aggregation functions inside summarize(): mean(), median(), sd(), min(), max() are the common ones. The summarize() function is typically used right after the group_by() function, which creates grouped data. Several examples will be useful to show us how this works.

Whenever adding stop() or stopifnot() statements to a function, it needs to be tested thoroughly to ensure it works (and stops) as expected. Listing 7.48 provides several examples where the function will be terminated because input errors will be caught by these new, defensive statements.