R ¿Cómo hacer un bucle for sin conocer la longitud?

Actualmente en estositio Estoy raspando la información del cuadro de tiro. Para raspar la información, necesito hacer un bucle for por la cantidad de tomas que haya. Encuentro el número de disparos haciendo clic en "Estadísticas del equipo" y encuentro el número de intentos de gol de campo.

Me gustaría hacer lo apropiadofor loop sin tener que averiguar el número de disparos.

Lo que estoy haciendo actualmente:

shotchart <- data.frame(shot=as.vector(0), class=as.vector(0), data_homeaway=as.vector(0), 
                    data_period=as.vector(0), player_id=as.vector(0), data_text=as.vector(0),
                    location=as.vector(0), gamenumber= as.vector(0))

for (i in 1:54)
{
 text <-paste0("//*[(@class='shots home-team')]//*[(@id)][",i,"]")
 shotchart[nrow(shotchart)+1,1]<- unlist(re$findElement(using='xpath',text)$getElementAttribute('id'))
shotchart[nrow(shotchart),2]<- unlist(re$findElement(using='xpath', text)$getElementAttribute('class'))
shotchart[nrow(shotchart),3]<-unlist(re$findElement(using='xpath', text)$getElementAttribute('data-homeaway'))
shotchart[nrow(shotchart),4]<-unlist(re$findElement(using='xpath', text)$getElementAttribute('data-period'))
shotchart[nrow(shotchart),5]<-unlist(re$findElement(using='xpath', text)$getElementAttribute('data-shooter'))
shotchart[nrow(shotchart),6]<-unlist(re$findElement(using='xpath', text)$getElementAttribute('data-text'))
shotchart[nrow(shotchart),7]<-unlist(re$findElement(using='xpath', text)$getElementAttribute('style'))
shotchart[nrow(shotchart),8]<-k-1

}

Cualquier ayuda será apreciada. Avíseme si necesita más información.

Respuestas a la pregunta(1)

Su respuesta a la pregunta