How to read a column subset of a csv file into a data frame in R?




I want to import some columns out of the csv file that I have into a data frame in R like we can do for the rows->

df<-read.csv(“train.csv”, stringsAsFactors=FALSE, nrows=1000)

How casn we do something similar in R to read some specific number of columns from the start or the end?



use skip to skip certain rows (as in to skip first 100 rows)

df<-read.csv(“train.csv”, stringsAsFactors=FALSE, nrows=1000,skip=100)


@ajay_ohri : I think what aditya is trying to ask is while importing he don’t want to include some columns, rather than skipping the rows…
@adityashrm21 : correct me if I am wrong.