, ( )
[ , R subset.c ~/src/main. VectorSubset. (.. , x[,1]), MatrixSubset.
VectorSubset . , . MatrixSubset, , dimnames.
, , , :
x <- matrix(1)
colnames(x) <- "foo"
x[, 1]
x[matrix(c(1, 1), ncol = 2)]
1 :
xx <- matrix(1:10, nrow = 1)
colnames(xx) <- sprintf('foo%i', seq_len(ncol(xx)))
xx[, 6]
xx[matrix(c(1, 6), ncol = 2)]
> 1:
yy <- matrix(1:10, nrow = 2, dimnames = list(NULL,
sprintf('foo%i', 1:5)))
yy[cbind(seq_len(nrow(yy)), 3)]
source
share