How can we read a random sample of records from a csv file in R?

r

#1

Hello,

I have a large dataset and my machine doesn’t support the import of such a large dataset. So I want to read a random sample from the file and perform data exploration on that sample. How can I directly read such a sample using R?

Thanks.


#2

have u tried fread from data.table


#3

Using fread from data.table i could import a 1.9 GB csv file. For Fread to handle big data it should be a 64 bit operating system with 4 GB RAM. Also a 1.9 GB csv file takes up around 2.3 GB of memory.
After loading it to a data.table split it to multiple data.table and save it in multiple RData files.
remove all objects from memory and then sequentially load each RData file for analysis.