Re: [Rcpp-devel] indexing matrix by row names and column names

2011-03-02 Thread Dirk Eddelbuettel
On 2 March 2011 at 12:18, Mahdi Shafiei wrote: | Hello, | In R, one can define a matrix and assign names to tows and columns: | | A = matrix(1:9, nrow=3, ncol=3); | rownames(A) = c("R1", "R2", "R3") | colnames(A) = c("C1", "C2", "C3") | | and then access entries in A by these row and column name

[Rcpp-devel] indexing matrix by row names and column names

2011-03-02 Thread Mahdi Shafiei
Hello, In R, one can define a matrix and assign names to tows and columns: A = matrix(1:9, nrow=3, ncol=3); rownames(A) = c("R1", "R2", "R3") colnames(A) = c("C1", "C2", "C3") and then access entries in A by these row and column names instead of row and column numbers like: A["R1", "C1"] I trie