I want to check if a row in data.frame() is a duplicate of an existing row. As already pointed out here one way might to be to use the duplicate function. However, if I'm using the function I get the following error:
Error: argument 'incomparables != FALSE' is not used (yet)
In a quite old mail somebody pointed out that this is actually a bug in R (more information over here). My data.frame() looks like this:
data.frame(val1=int,val2=int,val3=int,val4=float);
I'm wondering what the issue actually is since there seems to be no "NA" value in my data.frame, as
?duplicate
points out. This is maybe a very stupid question, but I'm quite new to R and would be glad for any tips regarding this issue!
Thanks in advance, Michael
P.S.: I've provided an example as suggested
table <- NULL;
foo <- function(n, d, nh, v){
newEntry <- data.frame(node_i=n, node_j=nh, dst=d, phi=v);
if(length(table != 0)){
if(!duplicated(table, newEntry)){
add(n, nh, d, v);
}else{
print("it is a duplicate!")
}
}else{
add(n, nh, d, v);
}
}
add <- function(n, d, nh, v){
rbind(table, data.frame(node_i=n, node_j=nh, dst=d, phi=v)) ->> table;
}
bar <- function(){
foo(23,42,5,4.0);
print(table);
foo(22,42,5,4.0);
print(table);
foo(23,42,5,4.0);
print(table);
}
However, this seems not to be a problem with duplicate() at all. I get the same error if I try to add another row sigh.