I have a list as follows:
list(c(TRUE, FALSE), TRUE, FALSE)
The list contains only one object with TRUE
, all others are a mix of TRUE
and FALSE
.
I want to work out the position number of the TRUE
only object, in this case the answer is 2
.
It sounds simple but I've failed so far.
Any ideas to solve this?
Use Position
like this:
L <- list(c(TRUE, FALSE), TRUE, FALSE) # test data
Position(isTRUE, L)
## [1] 2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With