R - loop and break after value found for each Rows
问题 I have a matrix of 0-1. What I would like to do is to loop into this matrix and search for the 1. Each time a 1 has been found, to simply jump or pass that row, in order to only record 1 value per row. What I am trying to know if the first episode of the sequence is a 1 . I was thinking there might be a solution with break But I am unsure how to use it properly. So this is my first matrix SoloNight = structure(c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,