我实现了功能'identify_case',即:
Document doc = new Document("https://myurl.com/andsoon");
Document iframeContentDoc;
Element iframe = doc.select("iframe").first();
String iframeSrc = iframe.attr("src");
if(iframeSrc != null) {
try {
iframeContentDoc = Jsoup.connect(iframeSrc).get();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
当我使用以下代码调用该函数时:
## Function that identify the gaps of NAs according to their length
identify_case = function(df, variable, seuil) {
df$value = ifelse(is.na(df[,variable])==TRUE,1,0)
df$temp = rep.int(rle(df$value)$lengths, rle(df$value)$lengths)
df$gap = ifelse(df$value == 1, df$temp, 0)
df$temp = NULL
df$case.nb = ifelse((df$gap > 0 & df$gap <= seuil),"cas1",ifelse((df$gap >
seuil),"cas2","OK"))
return(df)
}
我收到错误消息:
temp.df = identify_case(df = temporary_df,variable = "energy_NA",seuil
= 3)
奇怪的是,我添加了行
Error in identify_case(df = temporary_df, variable = "energy_NA", seuil = 3):
unused argument (seuil = 3)
在函数'identify_case'的开头。我没有收到任何错误,并且代码执行得很好。
即:
seuil = seuil
有人在这里发生什么事吗?