I googled around, but I could not find an answer to my question.
Functions like scan (base package) and fread (data.table package) do a very good job in reading just the first N lines from a .txt or .csv specified by the user. However, when it comes to .RData, load loads the entire file and there is no way to specify how many values shall be read from it.
I have .RData files which are over 3GB of size, each containing a single data.frame or data.table, and don't always need to load the entire file, but just, say, the first 100 or 1,000 rows of the object. Is there a way to do this?
Try read_lines_raw: