Dear List,
I am new to the raster package, but very excited that it can do focal calculations.

I read an Ascii file as a Spatial Grid (using spdep package) and then to a RasterLayer (using raster package) as follows:
#read ascii file in as a SpatialGrid
trial<-readAsciiGrid("data.asc")
#convert SpatialGrid to RasterLayer
raster.trial <- raster(trial)
Then I tried to clone RasterLayer so I have somewhere to put the focal values, but I am not sure whether this is correct:
raster.focal <- raster.trial
Then I tried to calculate focal values from "raster.trial" and write them to "raster.focal"
focal(raster.trial, ngb=3, fun=mean, na.rm=TRUE, filename="raster.focal")

Unfortunately I get the following errors:
Error in .Internal(which(x)) : no internal function "which"
In addition: Warning message:
In .getFormat(filename) : extension .focalis unknown. Using default format.
I am not sure how to interpret the error messages.
And I am not sure I have the correct approach with cloning the first raster file.

Can someone help?
Cheers
Beth.


	[[alternative HTML version deleted]]

