Closed curioustolearn closed 9 months ago
Interpolation enables you to access variables outside the scope of the macro.
Interpolation is achieved with !!
Try the following code with the added !!
using Tidier
sname = "ab12"
@chain df @filter(colX = !!sname)
Quick separate clarification I'll add in addition to the above answer. The purpose of @filter()
is to subset rows. So in general, you would use ==
instead of =
inside of @filter()
.
Please feel to reply with whether this answered your question, or provide a minimal reproducible example if you can. Thanks for using the package!
I'm going to close this issue. If you still have questions, please feel free to reply and we can re-open.
Suppose I have a variable called
sname = "ab12"
. If I dothings work as expected.
However, if I do:
I get the following error. I understand that it is looking for a column called
sname
. Is there a way to specify the value for filter stored in a variable name?Thank you.