Hello, I am trying to run a query that use a CASE statement from R. I am using the SQLDF package. The same query works fine in Mysql. The query gives the values of 0 or 1 to "express" according to the following situations:
Select "express" =
CASE
when E_MAIL like "%gmail%" then 1
when E_MAIL like "%yahoo%" then 1
when E_MAIL like "%hotmail%" then 1
else 0
END
from data
;
This is what I have tried in R:
alpha<-sqldf( "Select "express"=
CASE
when E_MAIL like "%gmail%" then 1
when E_MAIL like "%yahoo%" then 1
when E_MAIL like "%hotmail%" then 1
else 0
END
from data");
Any help will be appreciated!
Thank you