Use sqldf for faster reading of the input data.