2012-05-15 757 views

回答

19

除了在不確定函數的作用時閱讀幫助頁面之外,還可以檢查函數的實際代碼。例如,輸入read.delim揭示了函數包含以下代碼:

> read.delim 
function (file, header = TRUE, sep = "\t", quote = "\"", dec = ".", 
    fill = TRUE, comment.char = "", ...) 
read.table(file = file, header = header, sep = sep, quote = quote, 
    dec = dec, fill = fill, comment.char = comment.char, ...) 

因此,read.delim()是簡單地爲read.table()與製表符分隔的數據讀取時是方便的默認參數值的包裝功能。它與呼叫完全相同:

read.table(file, header = TRUE, sep = "\t", quote = "\"", 
    dec = ".", fill = TRUE, comment.char = "") 
3

從r幫助:

同樣,read.delim和read.delim2用於讀取分隔文件,默認爲分隔符製表符。注意這些變體中的header = TRUE和fill = TRUE,並且註釋字符被禁用。

相關問題