2016-08-13 31 views
0

我面臨的第一次包的發展R.如何實例打開.rda文件,同時記錄功能

我使用的是文件的例子:它包含了list包含多個對象的對象(vectorsdata.frame等),並將其放在namepackage\data文件夾中。

雖然記錄了軟件包的功能,我在示例中寫入以下代碼:

load("data/name_file.rda") 

但是,檢查包時,它給了我下面的錯誤:

load(file = "data/name_file.rda") 
Warning in readChar(con, 5L, useBytes = TRUE) : 
    cannot open compressed file 'data/name_file.rda', probable reason 'No such file or directory' 
Error in readChar(con, 5L, useBytes = TRUE) : cannot open the connection 
Calls: load -> readChar 
Execution halted 
Errore: Command failed (1) 
Esecuzione interrotta 

我感覺問題出在我使用的代碼或錯誤選擇的目錄上。 我使用RStudio在Mac中進行編程。有什麼建議?

在此先感謝。

+0

你是否在包的目錄?另外,你爲什麼不把這些例子作爲文檔文件(.rd)的一部分? –

+1

當然,我在.rd文件中編寫示例。當我檢查包裹時,問題就會彈出。 當前目錄是包的目錄。 – Achab

回答

0

也許解決:正確的代碼似乎是

data(name_file) 

不指定文件(.rda),也不目錄的擴展。