Given a data frame `df` with columns `d`, `c`, `v`. How do I find the value of `d` for the maximum value of `v` among the *subset* of records where `c == "foo"`?

I tried this:

```
df[df$v==max(df$v) & df$c == "foo","d"]

```

But I got: 

```
character(0)

```