Good question, Jannis.

I couldn't figure out how to specify the j argument in the "[" function as 
empty or missing either.

One work around is to specify ALL the columns as the j argument:

test <- matrix(1:4, 2)          # I think this is what you meant in your 
original post, not matrix[1:4, 2]
result1 <- test[2, ]
result2 <- do.call("[", list(test, 2, seq(dim(test)[2])))

test
result1
result2

Jean


`·.,,  ><(((º>   `·.,,  ><(((º>   `·.,,  ><(((º>

Jean V. Adams
Statistician
U.S. Geological Survey
Great Lakes Science Center
223 East Steinfest Road
Antigo, WI 54409  USA



From:
Jannis <bt_jannis@yahoo.de>
To:
r-help@r-project.org
Date:
08/03/2011 05:35 AM
Subject:
[R] syntax with do.call and `[`
Sent by:
r-help-bounces@r-project.org



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

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



	[[alternative HTML version deleted]]

