3.1 Finer control of CSV imports

We can provide finer control over importing text files using additional options (“adverbs”) to the import function (“verb”). For example, it might be good to check if all the column names are unique, and to make them not have spaces (which are awkward in terms of typing and functionality). You can add the option check.names = TRUE to the command:

hr_data <- import('data/HR_Data.csv', check.names = TRUE)

Similarly, if you’re using European data, where the decimal point is denoted by a comma, you can add the following option:

hr_data <- import('data/HR_Data.csv', check.names = TRUE, dec = ',')

You can see most of the options in the help file for import, which you can access either from the Help pane, or by typing ?import or help(import) in the console