mardi 9 mars 2021

Comparing rows in a matrix in R

I have to analyse a 25x25 matrix in R, comprised of 0,1. I have to create a function which finds the number of unique squares(made of four elements) with the two left-most values are 1 and the two right most are 0. (squares can over lap one another) So the square would look like this inside the matrix:

1 0 
1 0

Is there any way I can create a sub-matrix and search through the matrix or is there a method I can use to compare rows.

Thank you for reading.

Aucun commentaire:

Enregistrer un commentaire