
There's more...
To provide a cautionary tale about data import, let's look at the sCharger and tCharger columns more closely. Note that these columns indicate whether the car contains a super charger or a turbo charger, respectively.
Starting with sCharger, we look at the class of the variable and the unique values present in the data frame:
> class(vehicles$sCharger)
[1] "character"
> unique(vehicles$sCharger)
[1] "" "S"
We next look at tCharger, expecting things to be the same:
> class(vehicles$tCharger)
[1] "logical"
> unique(vehicles$tCharger)
[1] NA TRUE
However, what we find is that these two seemingly similar variables are different datatypes completely. While the tCharger variable is a logical variable, also known as a Boolean variable in other languages, and it is used to represent the binary values of TRUE and FALSE, the sCharger variable appears to be the more general character datatype. Something seems wrong. In this case, because we can, let's check the original data. Luckily, the data is in a .csv file, and we can use a simple text editor to open and read the file (Notepad on Windows and vi on Unix systems are recommended for the task, but feel free to use your favorite, basic text editor). When we open the file, we can see that sCharger and tCharger data columns either are blank or contain an S or T, respectively.
Thus, R has read in the T character in the tCharger column as a Boolean TRUE variable, as opposed to the character T. This isn't a fatal flaw and might not impact an analysis. However, undetected bugs such as this can cause problems far down the analytical pipeline and necessitate significant repeated work.