I've been encountering an odd syntax error in R while using sqldf. I'm joining two tables (gender_age_train.csv as traindf and phone_brand_device_model.csv as devices from this Kaggle competition) on the column device_id.
Those two tables have the columns:
> names(devices)
[1] "device_id" "phone_brand" "device_model"
and
> names(traindf)
[1] "device_id" "gender" "age" "group"
When I run the following code:
query = "SELECT t.group, d.phone_brand, d.device_model from traindf as t left outer join
devices as d on t.device_id = d.device_id"
merge_table1 <- sqldf(query)
I get the error:
Error in sqliteSendQuery(con, statement, bind.data) :
error in statement: near "group": syntax error
However, if I replace group in the query statement with any of its sibling columns like device_id, age, or gender, no error returns and I get the table as expected.
What else should I be investigating to find the source of the error?
