If your CSV only contains integers, you should use scan
instead of read.csv
, since ?read.csv
says:
‘read.table’ is not the right tool for reading large matrices,
especially those with many columns: it is designed to read _data
frames_ which may have columns of very different classes. Use
‘scan’ instead for matrices.
Since your file has a header, you will need skip=1
, and it will probably be faster if you set what=integer()
. If you must use read.csv
and speed / memory consumption are a concern, setting the colClasses
argument is a huge help.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…