So this works:
mydf[mydf$date %in% certaindate, "ret"]
# [1] 1.3
mydf[which(mydf$date %in% certaindate)+1,]$ret
# [1] 1.4
The function which(...)
returns the indices of all elements which meet the condition. Then you can add 1.
Your code was returning a logical vector (T/F). Adding 1 to that coerces all the logical to 0 or 1, giving a numeric vector of 1 or 2, which was then used to index df
.