I have 84 dta datasets in a folder and I want to load them into r and merge them (all datasets have the same columns). Since I cannot do it due to RAM memory issues, I have decided to select some variables and rows of the dataset. I would like to obtain a code to import these datasets (all from the same folder), naming the columns I want to obtain and getting only some rows based on a condition, in this case "year>=2015"
Will it work to read in one data set, reduce the number of rows and columns, read in the next and do the same then merge, etc.? That way you never have more than one full dataset in memory.
As mentioned by @startz you can use haven::read_dta() to only import a selection of variables into R. Therefore it might be enough to do something along those lines: