Using fread to only load datarows available in another dataframe

Viewed 42

I have large files (19 million rows x 16 columns) and want to harmonize one such file with a much smaller file (440 rows) using R.

I load the large file using fread and then use data.merge = merge(file1, file, by="car"). However, to reduce the memory needed in R I would like to avoid loading the whole big file. Is there a way to use fread to only load the rows I need (the overlap, e.g. only rows with the same car models in column "car" as file 1)?

For example:

fread("filepath.file2", by = file1$car)
0 Answers
Related