I tried to select specific data from the data frame in a batch manner of R language(3.6) but failed.
When I use
sqldf("select * from Interact where miRNA = 'hsa-miR-510-5p' and
Seqname ='chr3:195780289-195787118-' ")
it turned out ok.
While I tried
sqldf("select * from Interact where miRNA = Interpairs[1,1] and
Seqname =Interpairs[1,2]"),
or
sqldf('select * from Interact where miRNA = Interpairs$microRNA[1] and
Seqname = Interpairs$circRNA[1]')
it turned out wrong.
Error in result_create(conn@ptr, statement) : near "[1]": syntax error
I wonder whether anyone can help figure this out?
Interpairsis your R variable. Usepasteorsprintfto pass those variables in SQL statment. See here: stackoverflow.com/questions/17435086/…sqldfmagically bridges the gap in the presence/name of frames (as pseudo-tables), but does not bridge the gap for other variables. You might also considerglue::glue_sql.fn$sqldf("select * from Interact where miRNA= '`Interplym$microRNA[1]`' and Seqname = '`Interplym$circRNA[1]`' ")