I have heard people everywhere saying use data.table instead of data.frame or you can use data.table where ever you use data frame, but still i see a lot of differences like these
> myDF <- data.frame(x = rnorm(3), y = rnorm(3))
> myDT <- data.table(myDF)
> myDT[,1]
[1] 1
> myDF[,1]
[1] 0.6621419 0.8494085 0.6490634
> myDF[,c("x","y")]
x y
1 0.6621419 -1.8987699
2 0.8494085 -0.6273099
3 0.6490634 0.4566892
> myDT[,c("x","y")]
[1] "x" "y"
> myDT[,x,y]
y x
1: -1.8987699 0.6621419
2: -0.6273099 0.8494085
3: 0.4566892 0.6490634
> myDF[,x,y]
Error in `[.data.frame`(myDF, , x, y) : object 'y' not found
>
How exactly are they different and which one should i use?