I want to select data for the years 1990 to 2010, what should I do?

It seems mydata does not have the structure you think it has. Please post the out put of

str(mydata)

I think you have either not enough "()" or too many.
Assume data

mydata <- tibble(sex <- rep(c("male", "female"), 25), year <- (1971:2020))

Your code

mydata3 <-  mydata |> filter(sex == "female") & (year >= 1990 & year <= 2010)

These should work

mydata4 <- mydata |> filter((sex == "female") & (year >= 1990 & year <= 2010))

# or
mydata4 <-  mydata |> filter(sex == "female" & year >= 1990 & year <= 2010 )

I tried to use your code then it worked.Thanks

Ah good.

I edited my answer to correct some cut and paste mistakes so it should make mole sense now but the solutions are the same

I need my morning tea!