suppose I have
a <- array(1:256,rep(4,4))
and want to access a[1,2,3,1] by the vector c(1,2,3,1). As per yesterday, I can use do.call():
a[1,2,3,1] == do.call("[",c(list(a),c(1,2,3,1)))
Now how do I apply the above technique (or indeed any other technique!) to get
a[1,2,3,]
[1] 37 101 165 229
from a vector like c(1,2,3,0) or c(1,2,3,NULL) or c(1,2,3,NA)?
OBattempts:
do.call("[",c(list(a),c(1,2,3)))
do.call("[",c(list(a),c(1,2,3),NULL))
do.call("[",c(list(a),c(1,2,3,NULL)))
do.call("[",c(list(a),c(1,2,3,",")))none of these give what I want.
Anyone? -- Robin Hankin Uncertainty Analyst Southampton Oceanography Centre SO14 3ZH tel +44(0)23-8059-7743 [EMAIL PROTECTED] (edit in obvious way; spam precaution)
______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
