Convert to a function

Returns a summary table