0

I am trying to use filter from dplyr to filter columns starting with w and has values more than 11 and less than 4 ?

WBC_abnormal \<-Data %\>% select(starts_with("WBC")) %\>% filter(if_any(everything(), \~ . \< 4 | \>11))

error :

Error: unexpected '>' in "WBC_abnormal<-Data %>% select(starts_with("WBC"))%>% filter(if_any(everything(), ~ . < 4| >"

user438383
  • 5,716
  • 8
  • 28
  • 43
Abe
  • 1
  • Your code is not readable, please format it with `\`\`\`` . Read the guidelines for more informations. – vinalti Apr 04 '22 at 07:28
  • 1
    Also: It would be easier to help you if you provide [a minimal reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) including a snippet of your data or some fake data. – stefan Apr 04 '22 at 07:29
  • 1
    This said you could try with `~ . < 4 | . > 11` – stefan Apr 04 '22 at 07:31
  • 1
    Or use `between(., 4, 11)` to replace your `. < 4 | >11` – benson23 Apr 04 '22 at 07:33

0 Answers0