4
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【Rで大規模データを扱う】freadを使えば26倍早くcsvファイルを読み込める

Last updated at Posted at 2016-08-26

【方法】data.table パッケージの fread() を使う

Rの弱み:大規模データの処理

→ data.tableパッケージを活用することで大規模データも高速に処理可能

> library(data.table)
> 
> #Rで大規模csvファイルを読み込む
> 
> #read.csvで読み込む場合
> system.time(df.read.csv <- read.csv(file("C:/R_test/data/test.csv")))
   ユーザ   システム       経過  
     50.34       0.18      50.56 
> 
> #data.tableパッケージのfreadで読み込む場合
> system.time(df.fread <- fread("C:/R_test/data/test.csv"))
   ユーザ   システム       経過  
      1.92       0.02       1.94 

経過時間

1 2
read.csv 50.56
fread 1.94

freadの方が26倍以上早い!

↓参考サイト
http://mototeds.blogspot.jp/2016/03/rcsv.html

4
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?