I ran some simulations (coded in Julia) from which I have tons of data to extract. I want to analyze these data (that I dumped into .txt files) in R but it takes much time to import the .txt files.
Are there tips to improve the speed of data importation in R?
- I am using
read.table()
. Is there a faster function? - My .txt file have is relatively wide (many columns) but relatively short (few rows). Would I increase the performance by changing the format on my .txt file? Should I aim to have a square matrix or should I aim to dump all data into one line (or one column)?
- I have lots of boolean data. Would it be clever to replace my ones and zeros by true and false (or T and F)? (In the same logic, I realized that the function
sum()
is faster on a vector of true/false than on the same vector of 1/0). - Could I extract data and read data in binary files? Would it speed up data importation in R? Would it slow down my simulations in Julia?