2016-07-13 7 views
12

我試圖使用source_gistdevtools包,但我遇到了一個錯誤:R:source_gist不工作​​

> library(devtools) 
> source_gist("524eade46135f6348140") 
Error in r_files[[which]] : invalid subscript type 'closure' 

感謝您的任何意見。

+0

它追蹤到'devtools ::: find_gist'。儘管如此,還沒有弄清楚這個問題。它看起來像局部變量'which'沒有被識別。因爲'which()'是一個基函數,所以在全局環境中執行'1 [[which]]'也是一樣的錯誤。奇怪的。 –

+0

在'devtools ::: find_gist'中,if(length)(r_files)== 1'沒有'if()'的條件,它在你的情況下是這樣做的。我在控制檯中運行了前兩行'find_gist'來獲得'r_files'。這對我來說看起來像一個bug。我會把它帶到[devtools github頁面](https://github.com/hadley/devtools)並提交一個問題。 –

回答

11

同意這是一個錯誤,我看你有submitted

臨時的解決方法是指定的filename選項:

devtools::source_gist("524eade46135f6348140", filename = "ggplot_smooth_func.R") 
+1

此文件名解決方法也適用於我。 –

+1

這是[固定爲2017/08/01](https://github.com/hadley/devtools/commit/c0121bff3e70f2891eaacf94ff14acfb4eaab37e),儘管您需要[開發版本](https://github.com/hadley/devtools),直到此修復程序被推送到CRAN。 – manimal