If your data file does not have column headers, set header=FALSE.
The auto-mpg-noheader.csv file does not include a header row. The first command in the following snippet reads this file. In this case, R assigns default variable names V1, V2, and so on.
> auto <- read.csv("auto-mpg-noheader.csv", header=FALSE) > head(auto,2) V1 V2 V3 V4 V5 V6 V7 V8 V9 1 1 28 4 140 90 2264 15.5 71 chevrolet vega 2300 2 2 19 3 70 97 2330 13.5 72 mazda rx2 coupe
If your file does not have a header row, and you omit the header=FALSE optional argument, the read.csv() function uses the first row for variable names and ends up constructing variable names by adding X to the actual data values in the first row. Note the meaningless ...