John Richardson John Richardson - 1 year ago 48
R Question

Select rows in data table using a variable

I have a data table that I would like to filter rows based on a variable string. For example:

The above works but this doesn't:


I have tried [[str]] but that doesn't work either.

Thanks for your help

Answer Source

It's not best practice to get into the habit of using this. I would recommend rethinking whatever process generates the string. With that said you can do