Skip to content
Prev 311406 / 398513 Next

data after write() is off by 1 ?

Hello,

You are seeing the levels of a factor but saving its values. Internally, 
factors are coded as consecutive integers starting at 1, and that's what 
is saved to file using write.table. To have the levels "0", "1", etc and 
not the corresponding values 1, 2, etc, try

levels(prediction)[prediction]

or

as.integer(levels(prediction)[prediction])


Hope this helps,

Rui Barradas
Em 20-11-2012 19:30, Brian Feeny escreveu: