I have a rather large dataset named e
. One continuous covariate e$rad.dose
should range 0 - 60, however, I observed that four rows contain text and not numbers.
Question: how can I apply dplyr to remove these four rows?
I know several baseR solutions, but I am trying to improve my dplyr
.
> table(e$rad.dose)
0 12 12,5 14 15 16 21,6
156 3291 4 1 1 6 2 1
22 24 25 26 27,5 28 33,3 35
1 14 7 1 1 7 1 1
36 45 48 49,4 5,4 50 50,4 52
1 2 1 1 17 12 9 9
52,2 53,2 53,24 54 54,4 54,6 55 55,5
1 1 1 94 1 1 1 1
55,8 56 56,7 57 57,6 58 59,4 60
1 14 1 1 2 3 26 41
60,9 64 68 gammaknife GK
1 1 1 2 2
I have tried
filter(simpson %in% 1:3, age>=18, rad.dose!= c("gammaknife","GK"))
But two rows remain
> table(e$rad.dose)
0 12 12,5 14 15 16 21,6
32 2276 0 0 0 0 0 0
22 24 25 26 27,5 28 33,3 35
0 7 0 0 0 0 0 1
36 45 48 49,4 5,4 50 50,4 52
0 1 0 0 5 3 1 9
52,2 53,2 53,24 54 54,4 54,6 55 55,5
0 0 1 21 0 0 0 0
55,8 56 56,7 57 57,6 58 59,4 60
0 4 0 0 0 1 7 19
60,9 64 68 gammaknife GK
0 1 0 1 1
I also tried str_detect
but that did not solve it - or, at least, I have applied it wrongly:
filter(simpson %in% 1:3, age>=18, str_detect(rad.dose, c("gammaknife","GK")==FALSE))
Thank you in advance.