How do I take only a fraction of the data while reading in the csv file in R




I am having a very large dataset:

This is the first time I am handling such a large dataset and importing it and doing any sort of operation on it is extremely resource intensive.Even a small operation like substr takes a lot of time and hangs up the whole system.
I want to import only some records (maybe 10,000) and then do the operations.
How can i do this while reading in the file??



Use the option nrow in read.csv:

reco <- read.csv("Training.csv",sep = ",",stringsAsFactors = T,nrow = 10000)

Hope this helps!