In your R version, you don't need the call to `which()`, so you could do this instead:
dfrm$height[substr(dfrm$name,1,1) == "D"]
And here's a much clearer way to do it: subset(dfrm, grepl("^D", name), select = height)