[R] syntax with do.call and `[`

Jannis bt_jannis at yahoo.de
Wed Aug 3 12:30:03 CEST 2011


Dear List,



i would like to mimic the behaviour or the following indexing with a do.call construct to be able to supply the arguments to `[` as a list:


test   = matrix[1:4,2]

result = test[2,]


My try, however, did not work:

result = do.call(`[`,list(test,2,NULL))
result = do.call(`[`,list(test,2,))
result = do.call(`[`,list(test,2,''))


How can I use the do.call in that way with leaving the second indexing vector blanc?


Cheers
Jannis



More information about the R-help mailing list