Home Use Variables to Generalise a Paste query

# Use Variables to Generalise a Paste query

Aneesh
1#
Aneesh Published in 2018-02-13 08:01:05Z
 I have used this query to remove all items in my data set which are brought up in December 2017. I want to generalise this query by using variables instead of 'Dec' and '2017' as I will be firing this query every month. q2_sql_1 <- subset(q2_sql_1, ! paste(CAL_MONTH,YEAR,sep="_") %in% c('Dec_2017'))  The overall code is quite big, so it would be troublesome to find this line and edit every time. So, I have specified 2 variables at the beginning which I will edit every month. MMM <- "Dec" YYYY <- "2017"  How do I use these variables in the above query?
Aneesh
2#
 As answered by @lebatsnok q2_sql_1 <- subset(q2_sql_1, ! paste(CAL_MONTH,YEAR,sep="_") %in% paste0(MMM, "_", YYYY))