Can't you turn the lists into data frames issue unique and
force them back to lists. Here's the code:
L <- list(c("a1","a3","a4"), c("a1","a4","a5"), c("a1","a5","a6"))
M <- list(c("a1","a3","a4"), c("a2","a4","a5"), c("a1","a5","a6"), c("a7",
"a1", "a4"))
LL <- as.data.frame(I(L))
MM <- as.data
Thanx to all of you who helped me with my sets problem. ;-)
Patrick
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Patrick Meyer internet.lu> writes:
:
: It does not exactly do what it is meant to... Instead of breaking down,
: my code is looping forever now... I think I will have a deeper look at
: it tomorrow...
:
: In fact, I have two lists: let's say L and N.
:
: An elements (or set) of N must be add
It does not exactly do what it is meant to... Instead of breaking down,
my code is looping forever now... I think I will have a deeper look at
it tomorrow...
In fact, I have two lists: let's say L and N.
An elements (or set) of N must be added to L, if and only if it is not a
subset of an eleme
Patrick Meyer internet.lu> writes:
:
: Thank you Gabor.
:
: But I have a problem with the beginning of my algorithm, where the list
: you call L is empty... then the code breaks down... It says:
:
: "Error in any(...,na.rm = na.rm) : incorrect argument type"
:
: How can I handle this?
:
Go
Initialize the list with the first vector, instead of an emtry list, if you
can.
Andy
> From: Patrick Meyer
>
> Thank you Gabor.
>
> But I have a problem with the beginning of my algorithm,
> where the list
> you call L is empty... then the code breaks down... It says:
>
> "Error in any(...,
Andy, I don't think that you should be so quick to put yourself down.
Your solution just needs a 'sort' put in it so that order doesn't matter.
With Andy's solution the object can now be a character vector rather
than a list and 'match' can be used for testing new items:
newitems <- unique(newitems
Thank you Gabor.
But I have a problem with the beginning of my algorithm, where the list
you call L is empty... then the code breaks down... It says:
"Error in any(...,na.rm = na.rm) : incorrect argument type"
How can I handle this?
Thank you very much for your help
Patrick
__
> From: Gabor Grothendieck
>
> Pat Meyer hotmail.com> writes:
>
> :
> : Hi,
> :
> : First of all, let me thank you all for replying so rapidly
> to my first
> : question on this list. It was very very helpfull... and I'm
> learning R
> : faster and faster.
> :
> : I just encountered a sec
All the ways of doing such things (that I know of) in R only work on atomic
objects, so one way to do it is, again, concatenate the vectors into one
string, then do the comparison:
> lst = list(c("a1", "a3", "a4"), c("a1", "a4", "a5"), c("a1", "a5", "a6"))
> lst.vec <- sapply(lst, paste, collapse=
Pat Meyer hotmail.com> writes:
:
: Hi,
:
: First of all, let me thank you all for replying so rapidly to my first
: question on this list. It was very very helpfull... and I'm learning R
: faster and faster.
:
: I just encountered a second problem, which may also have a simple solution.
:
:
Hi,
First of all, let me thank you all for replying so rapidly to my first
question on this list. It was very very helpfull... and I'm learning R
faster and faster.
I just encountered a second problem, which may also have a simple solution.
Here it is:
In my program, a vector is a set of objects
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
13 matches
Mail list logo