this code below is to read and loop thru multiple binary (365) files for one year in one folder. In fact I have many folders for many years, 365 files of year of 2000 in one folder, 365 files of year of 2001 in another folder and so on.
My question is how can I loop from one year to another (from one folder to another)?
setwd("C:\\PHD\\Climate Data\\Wind\\")
listfile<-dir()
for (i in c(1:365)) {
conne <- file(listfile[i], "rb")
file<- readBin(conne, integer(), size=2, n=360*720, signed=T)
file<-file-273.15 #
close(conne)
to.write = file(paste("C:\\PHD\\Climate Data\\Out\\Temperature_",i,".dat",sep=""),"wb")
writeBin(file, to.write)
close(to.write)
}