I am trying to solve a question in R with regards to a complete function. I have tried to run the function from examples I have seen online, but they have yet to give me the right output that is needed. This is what I put in below.
complete <- function(specdata, id = 1) {
s <- vector()
for (i in 1:length(id)) {
path <- c(paste(specdata, "/",formatC(id[i], width=3,flag=0),".csv",sep=""))
specdata <- c(read.csv(path))
s[i] <- sum(complete.cases(specdata))
}
dat <- data.frame(cbind(id,nobs=s))
retu(dat)
}
