I have a data frame with two columns as shown below,
DT_EX = dt.Frame({'film':['Don','Warriors','Dragon','Chicago','Lion','Don','Chicago','Warriors'],
'gross':[400,500,600,100,200,300,900,1000]})
Here in first case i would like to filter the observations whose film is Don or Chicago as written in below code,
DT_EX[((f.film=="Don") | (f.film=="Chicago")),:]
In a second i would apply filter for 3 values as,
DT_EX[((f.film=="Don") | (f.film=="Chicago") | (f.film=="Lion")),:]
In case of filtering for more than 5 or 10 values, we are supposed to make a logical expression for these many values,and it would definatly be a time consuming task.
Is there any datatable way to get it done faster? like there are %in%
%chin%
kind of filtering options available in R data.table
.