6. Reading Data into
Now that we have seen some of
R’s basic functionality it is time to load in data. As with everything in
R, there are numerous ways to get data; the most common is probably reading comma separated values (CSV) files. Of course there are many other options that we cover as well.
6.1 Reading CSVs
The best way to read data from a CSV file1 is to use read.table. Many people also like to use read.csv, which is a wrapper around read.table with the
sep argument preset to a comma (
,). The result of using read.table is a
1. Even though CSVs can hold numeric, text, date and other types of data, it is actually stored as text and can be opened in any text editor.
The first argument to read.table is the full path of the ...