[datatable-help] Does setkey silently coerce numeric to integer?
djmuseR
djmuser at gmail.com
Sun Oct 10 23:56:18 CEST 2010
The documentation says that all variables serving as keys in a data table
must be of storage mode integer, so the short answer to your question is
yes. Integers and factors are 'naturally' of storage mode factor in R,
character variables assigned as keys are coerced to factor so that they have
storage mode integer and numeric variables assigned as keys are coerced to
integer for the same reason. I believe the reason for this (which is
explained in the vignette and FAQ, if memory serves) is to make binary
search as efficient as possible.
HTH,
Dennis
--
View this message in context: http://r.789695.n4.nabble.com/Does-setkey-silently-coerce-numeric-to-integer-tp2969728p2970678.html
Sent from the datatable-help mailing list archive at Nabble.com.
More information about the datatable-help
mailing list