I am trying to select some of the rows from a data frame, but it is giving the error.

My original dataframe has records from different iterations. I want to select records from iteration number 1. Here is the code I am using. v0 is the dataframe that has column iteration.

v <- v0[v0$iteration==1]

The error message is as follows. How to fix it?

Error in `v0[v0$iteration == 1]`:

! Must subset columns with a valid subscript vector.

ℹ Logical subscripts must match the size of the indexed input.

✖ Input has size 5 but subscript `v0$iteration == 1` has size 45550.