Interswitch interview question

Basically how to query data in R