Is it possible to display head() return for each for() sequence?

If I do the print() process in the for(), I can check it only when you are done.

Is it possible to display it for each sequence?

this is my code.

for (i in 1:10) {
  plot(iris$Sepal.Length[i:(i+10)],iris$Petal.Width[i:(i+10)])
  locator(1)
  head(iris[i:(i+10),])
}

The result of plot() is updated every time, but head() is not displayed.
Is there any way to display it every time?

Try putting a print() inside loops.

1 Like

thank you.
I didn't have the idea to print the table.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.