Could you tell me why the following command is a double vector? I'm not sure what I'm doing wrong.
TIA
filtered_tg <- filter(ToothGrowth, dose -- 0.5)
Error in `filter()`:
ℹ In argument: `dose - -0.5`.
Caused by error:
! `..1` must be a logical vector, not a double vector.
Run `rlang::last_trace()` to see where the error occurred.
I assume you have loaded the dplyr package. The problem is with your --, which is not an operator. R thinks you are using it to mean dose - (-0.5), or equivalently dose + 0.5, which is indeed a vector of doubles. I suspect you want to replace -- with a comparison operator, one of <, <=, ==, >= or >.