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.
_______________________________________________
datatable-help mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help

Reply via email to