[datatable-help] Column class assignment fails silelently

Chris Neff caneff at gmail.com
Wed Aug 3 16:49:39 CEST 2011


Apologies for the spam. This is me not understanding how class(x) <-
"numeric" behaves. Tried it with a vector and get the same issue.
Please ignore.

On 3 August 2011 10:40, Chris Neff <caneff at gmail.com> wrote:
> 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