[R] merge two data frame based on equal and unequal comparisons

Ding, Yuan Chun ycd|ng @end|ng |rom coh@org
Wed Apr 18 22:43:05 CEST 2018


HI All,

I found that other R users experienced the same problem when using sqldf package. An expert provided solution, adding "method="raw" at the end as below, one or more of the columns in my data.frame are of class "AsIs" ( I don't know what it is) .  When sqldf retrieves the result from SQLite it will be numeric or character and since it was originally of class AsIs,  it tries to convert it back but R provides no as.AsIs,  so it fails; use method = "raw", so sqldf will not try to convert  the results from the database.

DMRlog2pbde47DMS <- sqldf("select * from DMR_log2pbde47 as a left join DMS_log2pbde47 as b 
                           on a.chrom = b.chromo and a.start <= b.MAPINFO and a.end >= b.MAPINFO", method = "raw" )



-----Original Message-----
From: R-help [mailto:r-help-bounces using r-project.org] On Behalf Of Ding, Yuan Chun
Sent: Wednesday, April 18, 2018 10:38 AM
To: r-help using r-project.org
Subject: [R] merge two data frame based on equal and unequal comparisons

[Attention: This email came from an external source. Do not open attachments or click on links from unknown senders or unexpected emails.]





Dear R users,

I need to merge two data frames based on both equal and unequal comparisons.  The "sqldf" package used to work well , but today, I cannot resolve the following error by reinstallation of the sqldf package.   Can anyone suggest a different way to perform this kind of merge function?

Thank you,

Ding

> DMRlog2pbde47DMS <- sqldf("select * from DMR_log2pbde47 as a left join 
> DMS_log2pbde47 as b
+                            on a.chrom = b.chromosome and a.start <= 
+ b.MAPINFO and a.end >= b.MAPINFO" )
Error in get(as.character(FUN), mode = "function", envir = envir) :
  object 'as.AsIs' of mode 'function' was not found



---------------------------------------------------------------------
-SECURITY/CONFIDENTIALITY WARNING-
This message (and any attachments) are intended solely f...{{dropped:9}}




More information about the R-help mailing list