View source: R/count_subareas.R
count_subareas | R Documentation |
This function takes a binary matrix (0s and 1s) and divides it into rectangular subareas, counting the number of ones in each. Subareas are defined by the number of rows and columns specified by the user. If the matrix dimensions are not perfectly divisible by the subarea size, edge subareas may be smaller.
count_subareas(matrix_data, sub_rows, sub_cols)
matrix_data |
A matrix of 0s and 1s to analyze. |
sub_rows |
Number of rows in each subarea. |
sub_cols |
Number of columns in each subarea. |
A matrix where each cell corresponds to a subarea and contains the count of ones.
Other Spatial analysis:
AFSD()
,
BPL()
,
count_subareas_random()
,
fit_gradients()
,
join_count()
,
oruns_test()
,
oruns_test_boustrophedon()
,
oruns_test_byrowcol()
,
plot_AFSD()
set.seed(123)
mat <- matrix(sample(c(0, 1), 12 * 16, replace = TRUE), nrow = 16, ncol = 12)
count_matrix <- count_subareas(mat, sub_rows = 3, sub_cols = 3)
print(count_matrix)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.