R Plotly: Filter lines / data based on raw data that are not plotly attributes

I posted this question from StackOverflow two days ago but just realized that I may have a better chance of a response here. Hope it is OK to post the question here.

I would like to filter my lines / data based on more than 1 variables in my data set. This post shows how one could do this using the customdata attribute. For one variable, this works by mapping the single variable to customdata. What should I do for multiple? Thanks.

My goal is to filter data to be visualized using different fields. These fields do not correspond to plotting elements. The actions are not changing any aesthetic values.