Displaying 1 result from an estimated 1 matches for "difcount".
Did you mean:
defcount
2012 Mar 05
1
Error in file(fname, "r") : invalid 'description' argument when running maptools' readAsciiGrid on a dataframe
Hi,
I'm trying to calculate a sum of differences between two ascii grids.
I have the file names of the two grid files in a data.frame along with
other data. I'm then trying to add a new column to the data.frame with
the result of that calculation.
eg.
library(maptools)
difcount <- function(surfA, surfB) {
A <- readAsciiGrid(surfA, colname="a")
B <- readAsciiGrid(surfB, colname="b")
sum(A$a - B$b)
}
attach(mydataframe)
difcount(surfA[1],surfB[1]) #this test part works fine and gives me
the correct result
#But when I try to do a batch job...