我採購我的功能nnn.R
使用線路:錯誤:無法找到函數「nnn.R」
source("nnn.R")*
,並沒有得到任何錯誤,但是當我嘗試運行它,這是我所得到的:
Error: could not find function "nnn"*
這一切是什麼函數裏面
函數(x)is.null(x)
我採購我的功能nnn.R
使用線路:錯誤:無法找到函數「nnn.R」
source("nnn.R")*
,並沒有得到任何錯誤,但是當我嘗試運行它,這是我所得到的:
Error: could not find function "nnn"*
這一切是什麼函數裏面
函數(x)is.null(x)
nnn.R
是一個文件,而不是函數。該文件必須包含一個函數,定義爲:
nnn <- function(x) {
return (is.null(x))
}
注意nnn.R
可能包含幾個函數定義。參見例如this tutorial。
nnn是一個文件,而不是一個函數。你需要在「nnn.r」文件中創建一個函數來使用它:'myfun < - function(x){doin'stuff with x}''source'命令只讀取你在別處寫過的行;它不像MATLAB那樣工作。你可能想要將介紹掃描到R,特別是這個部分:http://cran.r-project.org/doc/manuals/R-intro.html#Writing-your-own-functions – Frank
哦,我明白了,這工作 nnn < - function(x){is.null(x)} 非常感謝你 – Musmar