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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.