[datatable-help] Column class assignment fails silelently

Chris Neff caneff at gmail.com
Wed Aug 3 16:40:06 CEST 2011


Hi all,

Lets say I have:

DT <- data.table(x=1:10, y=1:10)

Both x and y are of type integer.

> sapply(DT,class)
        x         y
"integer" "integer"

Now, suppose I do:

class(DT$x) <- "numeric"

What I would expect to happen is either A) a message saying you can't
convert a key to numeric or B) convert it to numeric and lose the key
argument. What happens though is that x stays as an integer but no
error is given.  Is that intended?

-Chris


More information about the datatable-help mailing list