Readr
Summary

Instruction

We had some issues with reading this file. Let's see what's going on.

First, we'll check the column types. We'll use the spec() function for this. It tells us which data types (integer, string, etc.) have been assigned to each column. spec() is quite easy to use. If we were using it on a dataset named students, for example, we would simply write:

spec(students)

It's good to know that readr has several read functions. These automatically decide on column data types, which can be quite handy – imagine having to do that yourself with a dataset of hundreds of columns! Instead, the read functions read the first 1,000 rows of data and determines the column data type based on that.

Exercise

Use the spec() function to check the data specifications in companies. Pay attention to the information returned.

Stuck? Here's a hint!

Type:

spec(companies)