Reputation: 63
I have a data set sales and another data set promotion. promotion data set has details of when the sales promotion has occurred. Now, I need to identify the data from sales that are associated to a particular promotion.
I have extracted the first row and created a filter
promo.filter="product.no==1100001369 & (customer.state==TN | customer.state==AP) & (cgrp==12 | cgrp==13)"
tried
promo.sales<-filter(sales, promo.filter)
and I get the following error
Error: filter condition does not evaluate to a logical vector.
How to I get this done.
Upvotes: 3
Views: 1070
Reputation: 21631
Try filter_(sales, promo.filter)
From the non-standard evaluation vignette:
Every function in dplyr that uses NSE also has a version that uses SE. There’s a consistent naming scheme: the SE is the NSE name with
_
on the end. For example, the SE version ofsummarise()
issummarise_()
, the SE version ofarrange()
isarrange_()
. These functions work very similarly to their NSE cousins, but the inputs must be “quoted”
Upvotes: 3