[R] Joining tables with different order and matched values

2017-05-15 Thread Jim Lemon
Hi Abo, This is essentially the same as your other problem. Notice that this solution will only work if the values in dt1 and dt2 are character, not factor and that I have replaced the space in "Drug name" with an underscore. R will automatically substitute a period when such a name is read in.

Re: [R] Joining tables with different order and matched values

2017-05-14 Thread jim holtman
Here is a solution to the "shared values" question > library(stringr) > input <- read.table(text = "A B + + 1,2,5 3,8,7 + + 2,4,6 7,6,3 ", + header = TRUE, + as.is = TRUE + ) > > input$'shared values' <- apply(input, 1, function(x){ +

Re: [R] Joining tables with different order and matched values

2017-05-09 Thread Boris Steipe
= "Drug name", all.x = TRUE) > > > A <-join_query(dt1, dt2, by = "Drug name") > > This returns a table showing results with changing the order of drugs in the > 2nd data frame. I want to see the results under > "indications" column without cha

Re: [R] Joining tables with different order and matched values

2017-05-09 Thread abo dalash
ot;indications" column. From: Ulrik Stervbo <ulrik.ster...@gmail.com> Sent: 09 May 2017 06:31 PM To: abo dalash Subject: Re: [R] Joining tables with different order and matched values Hi Abo, Please keep the list in cc - 1) the comments are

Re: [R] Joining tables with different order and matched values

2017-05-09 Thread Ulrik Stervbo
ge > From: Ulrik Stervbo <ulrik.ster...@gmail.com> > Date: 09/05/2017 7:42 a.m. (GMT+00:00) > To: abo dalash <abo_d...@hotmail.com>, "r-help@R-project.org" < > r-help@r-project.org> > Subject: Re: [R] Joining tables with different order and matched

Re: [R] Joining tables with different order and matched values

2017-05-09 Thread Ulrik Stervbo
Hi Abo, ?merge or the join functions from dplyr. HTH Ulrik On Tue, 9 May 2017 at 06:44 abo dalash wrote: > Hi All .., > > > I have 2 tables and I'm trying to have some information from the 1st table > to appear in the second table with different order. > > > For