Hi all,

I'm a new R user. I now have daily netcdf data for year 1979 such as these:
sm19790101.1.nc
sm19790102.1.nc
.
.
.
sm19791231.1.nc

I need to average a variable called "sm" to monthly resolution. I can now do this:

glob2rx("sm197901*.1.nc")  
jan<-list.files(pattern=glob2rx("sm197901*.1.nc"),full.names=TRUE)
to port all January data to jan, but I don't know how to open each file and get specific variable (I've had Rnetcdf package installed) . If I were to do this manually, it should be:

s19790101<-open.nc("sm19790101.1.nc")  
sm19790101<-var.get.nc(s19790101,"sm",na.mode=0)  
and then average them...

I guess the question is how to read files with a variable (e.g. 01-31) as part of the file name and then loop through the whole month.

Ed
	[[alternative HTML version deleted]]

