Sorry, that's the dataframe here below. I need to select only those rows where the variable ind is 1 and exclude when it's 0.
> data.frame(
+ hab = c(901, 5064, 439, 692, 1163, 320),
+ vote = c(0, 52.64, 0, 0, 0, 81.18),
+ ind = c(0, 1, 0, 0, 0, 1)
+ )
hab vote ind
1 901 0.00 0
2 5064 52.64 1
3 439 0.00 0
4 692 0.00 0
5 1163 0.00 0
6 320 81.18 1
And this is the code and library I've been running and the error outcoming. I think it's due to a library mistake, running a filter()function different from the one I need.
> library (dplyr)
Attaching package: ‘dplyr’
The following objects are masked from ‘package:stats’:
filter, lag
The following objects are masked from ‘package:base’:
intersect, setdiff, setequal, union
> filter(mydf$ind==1)
Error in UseMethod("filter_") :
no applicable method for 'filter_' applied to an object of class "logical"