How it works...

Step 1 shows some functions for tidying an lm object with the lm() function. The first step is to create the object. Here, we perform a multiple regression model using the mtcars data. We then use the tidy() function on the model to return the object summary of components of the model, for example, the coefficient, as a tidy dataframe. The augment() function returns extra per-observation data for an lm object should we want that—again, it's in tidy format. The glance() function inspects the model itself and returns summaries about itnaturally, in tidy format. glance() is useful for comparing models.

Step 2 shows the same process for the t.test object. First, we run a t-test on two vectors of random numbers. The tidy() function ...

Get R Bioinformatics Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.