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.
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){
+
= "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
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
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
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
6 matches
Mail list logo