Dear Sir,

I am getting this error

Error in rep(xi, length.out = nvar) :
  attempt to replicate an object of type 'closure'

I have read through the websites but cant really comprehend what this means?
Need your help.

This is my code

complete <- function(directory, idvec = 1:332) {
        df <- data.frame(id = integer(), nobs = integer())
    for (id in idvec) {
        filename <- paste(directory, "/",
                          sprintf("%03d", as.integer(id)),
                          ".csv", sep = "")
filename <- list.files()
        data <- rbind(data, read.csv(filename[id]))
}
str(data)
for (id in idvec)
        {nd <- data.frame(id = id,
                         nobs = nrow(na.omit(data)))
        df <- rbind(df, nd)
    }
    return(df)

}

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to