Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The most common way to read in a file is to use comma-separated values (CSV) data:
data<-read.csv("datafile.csv")
Since data files have many different formats, there are many options for loading them. For example, if the data file does not have headers in the first row:
data<-read.csv("datafile.csv",header=FALSE)
The resulting data frame will have columns named V1, V2, and
so on, and you will probably want to rename them manually:
# Manually assign the header namesnames(data)<-c("Column1","Column2","Column3")
You can set the delimiter with sep. If it is space-delimited, use sep=" ". If it is tab-delimited, use \t, as in: