@@ -351,22 +351,22 @@ haskey(kDT) # TRUE
351351key(kDT ) # "x"
352352
353353# Keyed subsetting (no 'on' needed)
354- setkey(kDT , x ) # Set a key on column 'x'
355- kDT [.(" a" )] # Returns all rows where x = "a"
354+ setkey(DT , x ) # Set a key on column 'x'
355+ DT [.(" a" )] # Returns all rows where x = "a"
356356
357357# Indexed subsetting (requires 'on')
358- setindex(kDT , x ) # Set an index on column 'x'
359- kDT [.(" b" ), on = " x" ] # Works, returns all rows where x = "b" (for detailed explanation visit setkey.rd)
360- # kDT [.("b")] # this will throw error
358+ setindex(DT , x ) # Set an index on column 'x'
359+ DT [.(" b" ), on = " x" ] # Works, returns all rows where x = "b" (for detailed explanation visit setkey.rd)
360+ # DT [.("b")] # this will throw error
361361
362362# single and multiple indices
363363# index on a single column ('y')
364- setindex(kDT , y )
365- indices(kDT )
364+ setindex(DT , y )
365+ indices(DT )
366366
367367# multi-column index
368- setindexv(kDT , list (" x" , c(" x" , " y" )))
369- indices(kDT ) # Shows an index on 'x' and a composite index on '(x,y)'
368+ setindexv(DT , list (" x" , c(" x" , " y" )))
369+ indices(DT ) # Shows an index on 'x' and a composite index on '(x,y)'
370370
371371# fast *keyed* subsets
372372kDT [" a" ] # subset-as-join on *key* column 'x'
0 commit comments