2
我有幾個函數,我試圖在R(工作室)實現。我將展示最簡單的一個。我試圖將名稱追加到一個向量上,以便稍後用作col.name。功能令人費解的錯誤
# Initialize
headerA <- vector(mode="character",length=20)
headerA[1]="source";headerA[2]="matches"
# Function - add on new name
h <- function(df, compareA, compareB) {
new_header <- paste(compareA,"Vs",compareB,sep="_")
data.frame(df,new_header)
}
# Comparison 1:
compareA <-"AA"
compareB <-"BB"
headers <- (headerA, compareA, compareB)
但我得到這個錯誤,這是非常令人費解。我搜索了它,但搜索太模糊/廣泛。
在運行時,我得到:
headers <- (headerA, compareA, compareB)
Error: unexpected ',' in "headers <- (headerA,"
爲其他功能的第二個錯誤是類似...
How do you say,'愚蠢,愚蠢...'; D – oaxacamatt
@oax - 發生在我們最好的:)。祝你好運。 – Chase