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!
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.