Re: [R] colnames from read.table

2008-07-30 Thread Erik Iverson
Chua Siang Li wrote: Hi. May I know why the colnames is NULL when reading only 1 column from a csv file? You are not "reading only 1 column from a csv file", you are subsetting one column of a data.frame. See ?Extract and the "drop" argument specifically. How do I get the colnam

[R] colnames from read.table

2008-07-30 Thread Chua Siang Li
Hi. May I know why the colnames is NULL when reading only 1 column from a csv file? How do I get the colname then? Thanks. > xy = read.table("dataFile.csv",header=T, sep=",") > y <- xy[,1] > xDate <- xy[,2] > x <- xy[,3:8] > colnames(y) NULL > colnames(xDate) NULL