I have a little problem with my loop in R. The idea is that I have 1000 files from queryCM_20131215.LST, queryCM_20131216.LST, ... queryCM_20170118.LST ; I want to extract the date for each file. But my result gives me only the last one. Is there a way out ? here is my code :
listLST <- dir(path = "C:/Users/BQKJ3140/Desktop/DOCS/base/histo/",pattern = "*.LST")
for (k in 1:length(listLST)){
file_name[[k]] <- listLST[[k]]
file_date[[k]]<- as.Date(strsplit(file_name[[k]],"_")[[1]][2], "%Y%m%d")
}