Skip to content
Prev 1537 / 29559 Next

Errore in sprintf(fmt, ...) ?

On Sat, 2 Dec 2006, Massimo Di Stefano wrote:

            
Nowadays I would suggest readRAST6() instead of readFLOAT6sp(), because it 
uses r.out.bin rather than r.out.arc from GRASS. The perl=TRUE warnings 
seems to be coming from string comparison somewhere inside a function 
called by readFLOAT6sp(), I don't think they are the problem.
morph <- as(x, "data.frame")

str(morph) # look inside morph
summary(morph)

sapply(morph, function(x) any(!is.finite(x)))
# check morph for NAs etc.
Yes, I think the problem is firstly that there are NAs in morph, and then 
that the string listing the row numbers of the NAs exceeds 8K characters
(your earlier message had: Errore in sprintf(fmt, ...) : La lunghezza 
della stringa eccede la dimensione del buffer di 8192)


So try clara on morph once you have omitted the NAs. If the NAs are for 
all variables in a row, coercing from SpatialGridDataFrame to 
SpatialPixelsDataFrame will work, if only some, you need to set the whole 
row to NA, coerce, cluster, add the clara results to the 
SpatialPixelsDataFrame, coerce back to SpatialGridDataFrame, then back to 
GRASS.

Once this is resolved, please post back to the list as well as to me, NAs 
do happen, expecially in geomorphometrics, for example around the edges 
where the filter is not fully within the window and/or mask.

Best wishes,

Roger