[STATSGRASS] Help - Inconsistent behavior, GRASS/R win/mac

Gregory Booma gcb2101 at columbia.edu
Wed May 11 16:59:37 EDT 2005


Answering my own post:

Quoting Gregory Booma <gcb2101 at columbia.edu>:

> The script runs fine on .dbf and
> .csv files created in ArcGIS 9.0 and Excel on Windows XP, but not
> on those created in GRASS 6.0 and Excel on MacOSX 10.3.9.

This is wrong. It turns out that the error is in my 'order' line in
the script. The two Windows files I was using had been pre-ordered,
allowing the script to run just fine.

The solution is to save the ordered data.frame as an object, as
follows:

attach(df)
newdf <- df[order(POVID,-AREA),]
freqtable <- as.data.frame(table(newdf$POVID))

for (i in 1:nrow(freqtable)){
	match <- which(newdf$POVID==freqtable$Var1[i])
	for (j in 1:length(match)){
		newdf$newid[match[j]] <- as.integer(newdf$POVID[match[j]]*10+j)
		}
    }

Note that I included attach() in the script this time. Just easier
than having to remember.

Hope this is useful,

Greg






More information about the grass-stats mailing list