我尝试编写一个函数来返回一个数据框,当我尝试运行时 cc< - complete(“specdata”,c(6,10,20,34,100,200,310)) 我收到错误消息“包装时出错:无法打开连接” 请帮忙(见下面的代码)。谢谢
complete <- function(directory, id = 1:332) {
y <- vector()
for(i in 1:length(id)){
x <- id
y <- c(y, sum(complete.cases(
read.csv(as.character(paste0("specdata","/","f",id[i],".csv"))))))
}
df <- data.frame(x, y)
colnames(df) <- c("id","ret")
return(df)
}