below R code show an example about vectors combination, after that, the attribute of vector "c" changed to character. how to make it still keep attribute as numeric?
a='aa';b='bb';c=c(1,2,3,4,5)
dd=data.table(cbind(a,b,c));dd;class(dd);class(a);class(b);typeof(dd$c)
running result as below:
> a='aa';b='bb';c=c(1,2,3,4,5)
> dd=data.table(cbind(a,b,c));dd;class(dd);class(a);class(b);typeof(dd$c)
a b c
1: aa bb 1
2: aa bb 2
3: aa bb 3
4: aa bb 4
5: aa bb 5
[1] "data.table" "data.frame"
[1] "character"
[1] "character"
[1] "character"
see typeof(dd$c) has been changed to "character" not numeric any more. how to keep it's original attribute?