I have a dataframe with columns: coast, weight gain, length gain, release weight, release length. Coast is categorical ("E" or "W") and the other variables are numeric. I would like to create a dataframe where I filter by specific ranges for each coast, but I'm having a hard time figuring out the correct syntax.
For instance, I have this:
newdata<-filter(mydata, coast=="E",
between(weight_gain, number, number) &
between(length_gain, number, number) &
between(weight_release, number, number) &
between(length_release, number, number))
That works fine, but it only considers coast "E" and I want to have another set of conditions for coast "W", which has slightly different numerical ranges. How do I combine the two conditions for "E" and "W" into one argument?
Thank you so much!