 <p>Posting comment as an answer since Bury says it works:</p> <p>It appears your vr is a character string. If you go this route, you'll need to do the infamous <code>eval(parse(text= paste0('subset(frame,' , vr,')' )))</code> construction.</p>