To read a file in R, you can use the read.table()
or read.csv()
functions depending on the file format. Here's an example of how to read a CSV file:
main.r147 chars9 lines
Alternatively, you can use the read.table()
function to read in other file formats such as tab-separated files:
main.r208 chars9 lines
Note that the header
argument specifies whether the first row of the file is a header (column names) or not. If the file does not have a header row, you can set header = FALSE
.
gistlibby LogSnag