I am working on simple data like below:
teacher student
12 409
43 403
12 415
12 409
67 311
19 201
I am trying to retrieve the entries where teacher = 12 and student = 409. I am using the following command:
library(sqldf)
sqldf('SELECT *
FROM df
WHERE teacher == 12 and student == 409')
I know it is a basic command, but when I run it, I get the following error message:
Error in asfn(rs[[i]]) : need explicit units for numeric conversion
I get the same error, even when I run:
# Without the and condition
sqldf('SELECT *
FROM df
WHERE teacher == 12')
or when I run this
# Single equal sign
sqldf('SELECT *
FROM df
WHERE teacher = 12')
Please note that in my current dataset df$teacher
and df$student
are both integers. I want to understand why am I getting this error. Any advice would be greatly appreciated.
My desired output is:
teacher student
12 409
12 409
Thanks!