Re: [R] The "Sets" package and element equality test

2011-10-08 Thread Johnny Paulo
Thanks, David. By going through the code, I came to a similar conclusion also: it seems the match.2.list function must be modified in the following way to make it work: match.2.list <- function(l1,l2){ if (class(l1)=="element"){ l1 <- l1[[1]] l2 <- l2[[1]] } length(l1)==length(l2) } because d

[R] Pb building sets of S4 / RefClass objects with package "sets"

2011-10-07 Thread Johnny Paulo
Hi, does anyone know if it is possible to construct sets of S4 objects? It seems the constructor set does not like it: Error in as.vector(x, "character") : cannot coerce type 'environment' to vector of type 'character' Regards Johnny [[alternative HTML version deleted]]

[R] Sets of general objects in R

2011-10-06 Thread Johnny Paulo
Hi, Is there a simple package to manage sets of general objects, and perform simple operations like: - union - intersection - difference - test for membership... but where the equality test between 2 objects is under the control of the programmer? In the base package, it seems only operations on

[R] The "Sets" package and element equality test

2011-10-06 Thread Johnny Paulo
Hi, I tried to use the sets package yesterday, which seems to be a very powerful package: thanks to the developers. I wanted to define sets of lists where 2 lists are considered equal if they have the same length. So, I implemented: match.2.list <- function(l1,l2){ length(l1)==length(l2) } and

[R] Weird behaviour of tab characters in a string in R (vs Python)

2011-10-05 Thread Johnny Paulo
Hello, I wanted to parse some information from a text, where fields are tab separated. When I copy the text into an R session (under emacs) like: mystring <- "field1 field2 field3" the tab character is replaced by a single space! For ex, if I type mystring, I get: "field1 field2 field3" The ta