get_elements | R Documentation |
Replicates the subset functionality of a matrix in R.
get_elements(x, row_ind, col_ind)
x |
A |
row_ind |
A |
col_ind |
A |
A vec
with each element listed according to index specification.
JJB
# Generate a Matrix
m = matrix(1:12, nrow = 4)
# Select Non-connect regions
row_index = c(1, 2, 1)
col_index = c(2, 2, 3)
# Subset in R
m[cbind(row_index, col_index)]
# Subset with Armadillo
get_elements(m, row_index - 1, col_index - 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.