R語言文件讀取方法|read.table()和read.csv()、read.delim()的區別

除了默認分隔符不同,沒有其它區別!

請看官方文檔:

read.csv and read.csv2 are identical to read.table except for the
defaults. They are intended for reading ‘comma separated value’ files
(‘.csv’) or (read.csv2) the variant used in countries that use a comma
as decimal point and a semicolon as field separator. Similarly,
read.delim and read.delim2 are for reading delimited files, defaulting
to the TAB character for the delimiter. Notice that header = TRUE and
fill = TRUE in these variants, and that the comment character is
disabled.

翻譯:

read.csv和read.csv2與read.table相同,但默認值除外。
它們用於讀取“逗號分隔值”文件(’.csv’)或(read.csv2)在使用逗號作爲小數點和分號作爲字段分隔符的國家/地區中使用的變體。
類似地,read.delim和read.delim2用於讀取默認分隔符爲TAB的文件。 請注意,這些變體中的header =
TRUE和fill = TRUE,並且註釋字符已禁用。

《R語言實戰》:

讀取Excel文件,推薦先導出成.csv文件再用read.csv導入。如果要直接導入,可以用xlsx包。

注:對於大型數據的讀取可以使用readr包和readxl包,速度比read.table()快很多。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章