Giter VIP home page Giter VIP logo

Comments (5)

robne1982 avatar robne1982 commented on July 1, 2024

I was unable to recreate this in a minimum example comparing round to rCompare with roundDigits

# Create two random variables ; b is equal to a with noise added
a <- runif(100)
b <- a + runif(100)*1E-8

# Do they match?
sum(a==b) # 0

for(i in 1:10) {
  mtch <- sum(round(a,i) == round(b,i))
  print(paste0("i = ", i, " : matches = ", mtch))
}

library(dataCompareR)

dfa <- as.data.frame(a)
dfb <- as.data.frame(b)
names(dfa) <- "COL1"
names(dfb) <- "COL1"


for(i in 1:10) {
  rcmp <- rCompare(dfa, dfb, roundDigits = i)
  mtchs <- if(is.null(nrow(rcmp$mismatches$COL1))) {
        100 
    } else {
      100 - nrow(rcmp$mismatches$COL1)
    }
    
  print(paste0("datacomp : i = ", i, " : matches = ", mtchs))
}

}

Which produces

[1] "i = 1 : matches = 100"
[1] "i = 2 : matches = 100"
[1] "i = 3 : matches = 100"
[1] "i = 4 : matches = 100"
[1] "i = 5 : matches = 100"
[1] "i = 6 : matches = 100"
[1] "i = 7 : matches = 96"
[1] "i = 8 : matches = 56"
[1] "i = 9 : matches = 4"
[1] "i = 10 : matches = 0"


Running rCompare...
[1] "datacomp : i = 1 : matches = 100"
Running rCompare...
[1] "datacomp : i = 2 : matches = 100"
Running rCompare...
[1] "datacomp : i = 3 : matches = 100"
Running rCompare...
[1] "datacomp : i = 4 : matches = 100"
Running rCompare...
[1] "datacomp : i = 5 : matches = 100"
Running rCompare...
[1] "datacomp : i = 6 : matches = 100"
Running rCompare...
[1] "datacomp : i = 7 : matches = 96"
Running rCompare...
[1] "datacomp : i = 8 : matches = 56"
Running rCompare...
[1] "datacomp : i = 9 : matches = 4"
Running rCompare...
[1] "datacomp : i = 10 : matches = 0"

from datacomparer.

robne1982 avatar robne1982 commented on July 1, 2024

Also tried a multi column approach - I wondered if the lapply calling round may have let to oddities on replication of the roundDigits argument.

So I made a 4 column dataframe

(and apologise for the awful code)


a <- runif(100)
b <- runif(100)
c <- runif(100)
d <- runif(100)

a2 <- a +  runif(100)*1E-8
b2 <- b +  runif(100)*1E-8
c2 <- c +  runif(100)*1E-8
d2 <- d +  runif(100)*1E-8

df1 <- data.frame(a,b,c,d)
df2 <- data.frame(a2,b2,c2,d2)
names(df2) <- names(df1)

for(i in 1:15) {
  rcmp <- rCompare(df1, df2, roundDigits = i)
  mtchsa <- if(is.null(nrow(rcmp$mismatches$A))) {
    100 
  } else {
    100 - nrow(rcmp$mismatches$A)
  }
  
  mtchsb <- if(is.null(nrow(rcmp$mismatches$B))) {
    100 
  } else {
    100 - nrow(rcmp$mismatches$B)
  }
  
  mtchsc <- if(is.null(nrow(rcmp$mismatches$C))) {
    100 
  } else {
    100 - nrow(rcmp$mismatches$C)
  }
  
  mtchsd <- if(is.null(nrow(rcmp$mismatches$D))) {
    100 
  } else {
    100 - nrow(rcmp$mismatches$D)
  }
  
  print(paste0("datacomp : i = ", i, " : matches = ", mtchsa, " , ", mtchsb, " , ", mtchsc , " , ", mtchsd))
}

But this seems to work too

Running rCompare...
[1] "datacomp : i = 1 : matches = 100 , 100 , 100 , 100"
Running rCompare...
[1] "datacomp : i = 2 : matches = 100 , 100 , 100 , 100"
Running rCompare...
[1] "datacomp : i = 3 : matches = 100 , 100 , 100 , 100"
Running rCompare...
[1] "datacomp : i = 4 : matches = 100 , 100 , 100 , 100"
Running rCompare...
[1] "datacomp : i = 5 : matches = 100 , 100 , 100 , 100"
Running rCompare...
[1] "datacomp : i = 6 : matches = 100 , 100 , 100 , 100"
Running rCompare...
[1] "datacomp : i = 7 : matches = 94 , 93 , 96 , 96"
Running rCompare...
[1] "datacomp : i = 8 : matches = 49 , 51 , 54 , 47"
Running rCompare...
[1] "datacomp : i = 9 : matches = 2 , 6 , 8 , 4"
Running rCompare...
[1] "datacomp : i = 10 : matches = 0 , 0 , 2 , 1"
Running rCompare...
[1] "datacomp : i = 11 : matches = 0 , 0 , 0 , 0"
Running rCompare...
[1] "datacomp : i = 12 : matches = 0 , 0 , 0 , 0"
Running rCompare...
[1] "datacomp : i = 13 : matches = 0 , 0 , 0 , 0"
Running rCompare...
[1] "datacomp : i = 14 : matches = 0 , 0 , 0 , 0"
Running rCompare...
[1] "datacomp : i = 15 : matches = 0 , 0 , 0 , 0"

from datacomparer.

robne1982 avatar robne1982 commented on July 1, 2024

Have asked the user to provide a minimal broken example for further investigation.

from datacomparer.

robne1982 avatar robne1982 commented on July 1, 2024

The user hasn't come back with any further information - I will leave this open with the wontfix label for now.

from datacomparer.

robne1982 avatar robne1982 commented on July 1, 2024

Change of heart with wontfix - I want a tidy repo!

from datacomparer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.