for-loop for opening a series of files
Hi, you may use list.files('dir-of-your-files', ...) to get the paths
of all the files, and use file.info() to get the date attribute, then
order them by date, and finally in a loop
for(i in paths-of-your-files){
open.ncdf(i, ...)
...
}
Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086
Mobile: +86-15810805877
Homepage: http://www.yihui.name
School of Statistics, Room 1037, Mingde Main Building,
Renmin University of China, Beijing, 100872, China
On Thu, Sep 18, 2008 at 5:13 AM, Brian Pettegrew
<Brian.P.Pettegrew at noaa.gov> wrote:
Hello, I am fairly new to R programming. I have a series of netcdf files that I am able to open one at a time using open.ncdf. I want to write this into an R script so that I can successively open each file by date in a for-loop. Any suggestions? Thanks Brian Pettegrew -- Brian Pettegrew Research Associate Cooperative Institute for Environmental Sciences NOAA/ESRL/Global Systems Division Boulder, CO Phone: (303) 497-4129 E-mail: Brian.P.Pettegrew at noaa.gov