Seems to work great! I have a last question (or 2) for you about it, and I will leave you alone afterwords, I promise :)
I tested your function process.all for the automatization. It seems to be OK. It's just when I'd like to save the filled data files. If I name process.all, for example: test <- process.all(lst, corr2008) and I save it: write.table(test, ...) and I check the test file, It has filled my data but all the files from "lst" are in one file (the columns are: ST001, ST001_time, ST002, ST002_time, ..... (with ST001 for station 1 for example)). How can I cut these files and save them automatically (one file for ST001, another for ST002, ...) according to these columns names? And it is possible in your script to take the second best correlated station data instead of the best one, if there are NAs in this best correlated station at the same lines with the NA gaps of the station to fill? Thanks again for all your help. If you come one day in France near the Alps or Chamonix (where I'm working), just tell me. I'll pay you some beers or a restaurant! You deserve it ^^ By the way, where do my rescuer come from? Are you a statistician? Geoffrey -- View this message in context: http://r.789695.n4.nabble.com/take-data-from-a-file-to-another-according-to-their-correlation-coefficient-tp4580054p4586079.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.