[GRASS-user] v.class.mlR Error in data.frame : arguments imply differing number of rows

Moritz Lennert mlennert at club.worldonline.be
Tue Apr 16 08:14:38 PDT 2019


On 16/04/19 16:50, Jamille Haarloo wrote:
> Replacing
> ids <- rownames(features)
> with
> ids <- rownames(predicted)
> is the only edit I did after the previous try, so this should have 
> solved the error.

Watch out: I'm not sure that this is really equivalent. I think I used 
the rownames(features) to get the original ids of the features, while 
rownames(predicted) apparently gives 1,2,3,4,etc. So you will not be 
able to link the results back to your original features...

> 
> If I understood correctly na.action = na.exclude can help to work around 
> the NA values without deleting rows but somehow I did not work. The user 
> can always compare the original data rows to the results, right? As in 
> my case, comparing the results file to the vector file shows that 17849 
> of 17851 segments were classified as expected from the error. I did not 
> loose any original data and also saved a copy. If you mention in the 
> manual that intermediate na values might block the analyses and will 
> therefore be omitted from the final results, it should be perfectly fine.

You are right that na.exclude is probably better here than na.omit. 
IIUC, this will give you NAs in the prediction output as well.

So I think that na.exclude is probably the safest bet and shouldn't 
create too much of a surprise for the user.

> I noticed a minor issue; not all results were added to the vector file - 
> about 686 segments (almost 4% of the data) were somehow missed. 

That's weird. Maybe this is due to the different ids ?

Moritz


More information about the grass-user mailing list