Re: [R] Union of two data frames

2006-09-20 Thread Anupam Tyagi
Kartik Pappu kartik.pappu at gmail.com writes: Essentially, I want to make a union of the two data frames. I hope this question makes sense. See merge(...), and have a look at R intro. Also check documentation for Design package. Anupam. __

[R] Union of two data frames

2006-09-19 Thread Kartik Pappu
Hi, I have two data frames each with 5 columns and different number of rows. some of the row names in one data frame are the same as the row names in the other. I want to be able to merge the two data frames to get a new data frame in which the duplicated row names are only shown once with the

[R] Union of two data frames

2006-09-19 Thread Gamal Azim
How about, uxy - union(row.names(x), row.names(y)) ixy - intersect(row.names(x), row.names(y)) rbind(x[is.element(row.names(x),uxy),], y[!is.element(row.names(y),ixy),]) Note, simple rbind'ing of the two frames changes common row.names. Gamal __

Re: [R] Union of two data frames

2006-09-19 Thread Gabor Grothendieck
Try either of these: rbind(DF1, DF2[setdiff(rownames(DF2), rownames(DF1)),]) rbind(DF1, DF2[!(rownames(DF2) %in% rownames(DF1)),]) On 9/19/06, Kartik Pappu [EMAIL PROTECTED] wrote: Hi all, I have two data frames each with 5 columns and different number of rows. some of the row names in one

Re: [R] Union of list elements

2004-12-18 Thread Jean Eid
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.frame(I(M)) X -

[R] Union of list elements

2004-12-17 Thread Pat Meyer
__ [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

[R] Union of list elements

2004-12-17 Thread Pat Meyer
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

RE: [R] Union of list elements

2004-12-17 Thread Liaw, Andy
From: Gabor Grothendieck Pat Meyer paterijk at 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

[R] Union of list elements

2004-12-17 Thread 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(...,na.rm = na.rm) : incorrect argument type How can I handle this? Thank you very much for your help Patrick

Re: [R] Union of list elements

2004-12-17 Thread Patrick Burns
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 -

RE: [R] Union of list elements

2004-12-17 Thread Liaw, Andy
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(...,na.rm =

Re: [R] Union of list elements

2004-12-17 Thread Gabor Grothendieck
Patrick Meyer patrick.meyer at 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

Re: [R] Union of list elements

2004-12-17 Thread Gabor Grothendieck
Patrick Meyer patrick.meyer at 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)

[R] Union of list elements

2004-12-17 Thread Patrick Meyer
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

[R] UNION

2004-03-29 Thread Margarida JĂșlia Rodrigues Igreja
Hi, I have a problem, can you help? When i type: library(RODBC) a-odbcConnect(oracle) sqlQuery(a,(select VALFACT500 from EPISGDHS) UNION (select VALFACT1000 from EPISGDHS)) Comes the error: [1] S1000 923 [unixODBC][Easysoft][Oracle]ORA-00923: FROM keyword not found where expected at