how to compare the difference between two similar tables datapoint by datapoint in r -


i have table (df1) looks this:

i           id col.3 col.4 col.5 col.6 col.7 col.8 m   chr18_1369     g     g     t     g     g     g m  chr18_54979     g     n         n     g     g m chr18_187626     c     t     n     t     c     c m chr18_196254     c     c     g     c     n     g m chr18_224569             c     n     c     c m chr18_275670     t     t     c     c     t     t 

there missing data points represented "n" in df1. after imputation, missing data "n" replaced letter. output df2 as:

i           id col.3 col.4 col.5 col.6 col.7 col.8 m   chr18_1369     g     g     t     g     g     g m  chr18_54979     g     g         g     g     g m chr18_187626     c     t     t     t     c     c m chr18_196254     c     c     g     c     c     g m chr18_224569             c         c     c m chr18_275670     t     t     c     c     t     t 

i have data frame (df3)

i           id col.3 col.4 col.5 col.6 col.7 col.8 m   chr18_1369     g     g     t     g     g     g m  chr18_54979     g     g             g     g m chr18_187626     c     t     c     t     c     c m chr18_196254     c     c     g     c     c     g m chr18_224569             c     c     c     c m chr18_275670     t     t     c     c     t     t 

the df3 has same structure df2 character values may different in corresponding locations of missing data "n" in df1. example, df2[2,6]=="g",but df3[2,6]=="a", , df2[3,5]=="t",df3[3,5]=="c" ... want calculate difference rate between df2 , df3. formula is:

u <- length(which(df1 =="n", arr.ind=true)) diff = length(difference(df2,df3))/u 

i don't know how length(difference(df2,df3)). need elegant script task. thank in advance.

sum( df2 == df3 )

does not work?


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -