[R] help with sqldf

Sarah Goslee @@r@h@go@|ee @end|ng |rom gm@||@com
Sun Jun 28 23:01:18 CEST 2020


WIthout knowing anything about your research domain, take a look at
what your sql looks like:

"select * from r where V1 like markerinfo$flank1[1] "

You are asking to match literally "markerinfo$flank1[1]" and not the R
object referred to.

Try something more like,

paste("select * from r where V1 like", markerinfo$flank1[1])

Sarah



On Sun, Jun 28, 2020 at 4:35 PM Yuan Chun Ding <ycding using coh.org> wrote:
>
> Hi R Users,
>
> I tried to use sql in R;  test1 works well,
> library(sqldf)
> test1 <- sqldf("select * from r where V1 like '%GCCATGTCAGCACACTACC%TGAAACCTTTAACTATTT%'")
> test2 <- sqldf("select * from r where V1 like markerinfo$flank1[1] ")
>
> but I want to store the search content in a markerinfo file as shown below
> > markerinfo$flank1[1]
> [1] "%GCCATGTCAGCACACTACC%TGAAACCTTTAACTATTT%"
>
> However, test2 does not work well.
> How to make test2 work?
> Thank you,
>
> Ding
>
>
> ----------------------------------------------------------------------

-- 
Sarah Goslee (she/her)
http://www.numberwright.com



More information about the R-help mailing list