hello
i have a list of pairs for example {(1,2),(2,1),(4,5),(5,4)}, what i'm trying to do to remove the duplicate by deleting the pairs (2,1),(5,4) so the list will be {(1,2),(4,5)} , i have this code
v<- lapply(v, function(s) {s[[NULL]] <- NULL; s})
v<-lapply(v,function(y){x1 <- unlist(y)
l1 <-unique(lapply(split(as.vector(x1),as.vector(gl(length(x1), 2,length(x1)))), sort))
do.call(set,lapply(l1, function(y) pair(y[1], y[2])))
now this code working very will but sometimes it gave me this error
"Error in split.default(as.vector(x1), as.vector(gl(length(x1), 2, length(x1)))) : first argument must be a vector for example if i have this list of pairs"
i'm using Rstudio with sets and igraph packages
thanks