[R] user defined variables and dataset

Using Plotly/R how can a user define which variables to plot from which dataset. Instead of hardcoding them I want to dynamically send plotly the variables and dataset to plot.
For eg
Plot variables V1 and V2 from dataset1 and variables V1 and V5 from dataset2 in the same plot.
The variables and dataset are not know before hand.