I have a dataset with 100 columns and it doesn't have a header.
I have an int vector that consists of some numbers ranges between 1 to 100. For example, a vector with "2 5 62 78".
Now when I read the dataset using read.table, all I want is to select column 2, 5, 62 and 78 from the dataset. How can I do that? Many thanks.
?read.table
optioncolClasses
. If you set it to"NULL"
(that's a character), it will skip the column. – ilirfoo<-read.table(datafile); foo<-foo[,c(2,5,62,78)]
thanfoo<-read.table(datafile,colClasses=c(rep('numeric',1),NULL,rep('numeric',2),...)
– Carl Witthoft