[datatable-help] Return Select/Join that does NOT match?

Matthew Dowle mdowle at mdowle.plus.com
Sun Aug 15 21:48:18 CEST 2010



Branson Owen wrote:
> 
>> DT = data.table(A = c("o", "x"), B = 1:10, key = "A")
>       A  B
>  [1,] o  1
>  [2,] o  3
>  [3,] o  5
>  [4,] o  7
>  [5,] o  9
>  [6,] x  2
>  [7,] x  4
>  [8,] x  6
>  [9,] x  8
> [10,] x 10
> 
>> DT[J(unique(A))]
> Error hint: the i expression sees the column variables. Column names
> (variables) will mask variables in the calling frame. Check for any
> conflicts.
> Error in `[.data.table`(DT, J(unique(A))) :
> Error in unique(A) : object 'A' not found
> 
>> DT[  {  J(unique(A))  }  ]
>      A B
> [1,] o 1
> [2,] x 2
> 

Bug #1005 from Branson is now fixed. Added test 183, item to NEWS
and committed rev 131.
DT[J(unique(A))] now finds the column A in DT and returns the same
result as wrapping with {}.
Thanks Branson for finding it.

Matthew


-- 
View this message in context: http://r.789695.n4.nabble.com/Return-Select-Join-that-does-NOT-match-tp2315211p2326190.html
Sent from the datatable-help mailing list archive at Nabble.com.


More information about the datatable-help mailing list