large data - How do i read only lines that fulfil a condition from a csv into R? -
I am trying to read a large CSV file in R. Although the file is large, I just want to work with some of the rows that satisfy a particular condition (such as variable 2> = 3). This is a very small dataset, instead of loading the entire dataset into the dataframe, I would like to read these lines directly in the datafire and then select according to the status. The main reason is that the dataset is not easily fit in the memory of a desktop or laptop. I'm looking for a solution that only uses R, and it does not require dragon or other languages. Thanks. You can use the read.csv.sql function in sqldf package and SQL selection. read.csv.sql : library (sqldf) write.csv (iris, "iris.csv", quotation = incorrect, line name = FALSE) iris2 & lt; - read.csv.sql ("iris.csv", sql = "Choose from file * where SEPOL.LANG> 5", eol = "\ n")