hello everybody, I have a directory with over 3000 files with different names. I would like to make some vectors with the file names which are belong together.
I'm trying to do it with a for loop in R: SF <- c("ad", "cd", "cer", "stress", "salty", "PC", "high", "transfer", "cold", "heat") # the pattern to look for names(SF) <- as.vector(SF) for (i in 1:length(SF)){ write(names(SF)[i], "") for (j in 1:length(SF)) {list[j] <- grep(names(SF)[j], list.files(),value=TRUE) #character vector with the specified stress factor } } but all I'm getting is this Error in list[j] <- grep(names(SF)[j], list.files(), value = TRUE) : object of type 'builtin' is not subsettable I would like the loop to make in each round a list of the files with the pattern in the directory I'm looking in. what am i doing wrong? If I doing it for each element I'm getting the correct list. THX for the help Best Regards Assa Yeroslaviz [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list 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.