I like to extract the index number from the list. The which () function returns an integer (0), and I don't know why. I created a list containing the following vector
[[5]]$bar
[1] -1.35 -1.34 -1.33 ,....,
[121] -0.15 -0.14 -0.13 -0.12 -0.11 -0.10 -0.09 -0.08 -0.07 -0.06 -0.05
which I retrieve with:
b <- foo[[5]]$bar
Now I want to request an index number from -1.35 (for example). I used the command: which (b == -1.35)and returns an integer (0) instead of [1].
If I create a similar vector with <- c (x, ..., - 1.35), which function will return the index number correct. Both a and b are numeric vectors with elements of type double, where is the difference between them and how can I extract the index number from the list?
Thank you for your help!
source
share