From the course: Cleaning Bad Data in R

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Text improperly converted to numbers

Text improperly converted to numbers

From the course: Cleaning Bad Data in R

Start my 1-month free trial

Text improperly converted to numbers

- [Man] Data analysis tools are usually very good at guessing the format of data and reading it correctly without having to be explicitly told what variable types to use. However, as you saw in the last video, that doesn't always work out. Another common issue that occurs with reading in data, is when text data is improperly read into a numeric data type. The key observation is that numerals aren't always numeric. Sometimes they're just text, and treating them as numeric values can cause real problems. Now that might sound odd, but let's take a look at a common example. Here I have the code, ready to load in the data set containing information about state capitals and their populations. Let's go ahead and load this data set. We'll begin by loading the tidyverse and lubridate. We'll change our working directory and then read in the capitals.csv file. I'm doing this, using the default settings of read csv. When I don't specify the variable types, read csv provides in red text, the…

Contents