If I have a vector v with names:
John Murray Lisa Mike Joe Ann 0.0832090 0.0475580 -0.2797860 0.1086225 0.0104590 -0.0028250
What is the time complexity of v['Joe'] compared to v[4] ? I assume the former will accept O (log n), as it should include a binary search, but I'm still not sure if the latter is O (1) or not.
In addition, is the result generalized to the case when v is a list / data frame and not an atomic vector?
source share