Re: [R] create groups from data with duplicates, such that each group has a duplicate represented once

2019-01-17 Thread Kevin Wamae
Dear Petr, thank you for the guidance. A colleague managed to solve it I'll definitely use "dput" for future postings. Regards ------ Kevin Wamae On 17/01/2019, 03:57, "PIKAL Petr" wrote: Hi Instead of attachment which is usually re

[R] create groups from data with duplicates, such that each group has a duplicate represented once

2019-01-16 Thread Kevin Wamae
Hi, I have a sequencing run with ~3000 samples (attached dataset). The samples were initially tagged and amplified by PCR in duplicate. The tags used range from MID01 to MID26. MID01-MID13 were used for pair 1 while MID14-MID26 were used for pair 2. The tags are re-used to allow samples to be p

Re: [R] alternative for multiple if_else statements

2018-02-26 Thread Kevin Wamae
gards -- Kevin Wamae On 26/02/2018, 14:57, "S Ellison" wrote: That many ifelse statements is obviously rather a pain. Would you not have got what you want with ... paste("survey", year, sep="_") ? If that is not what you'

Re: [R] alternative for multiple if_else statements

2018-02-22 Thread Kevin Wamae
Dear Eric, thank you for that observation. I realised that some of the participants have duplicated “survey_start” dates and when I corrected this, the code works. Regards -- Kevin Wamae From: Eric Berger Date: Thursday, 22 February 2018 at 15:16 To: Kevin Wamae Cc: "R-h

Re: [R] alternative for multiple if_else statements

2018-02-22 Thread Kevin Wamae
Dear Ista, thank you. Let me see how best I can implement this. Regards -- Kevin Wamae On 22/02/2018, 16:58, "Ista Zahn" wrote: I don't fully understand the logic you are trying to implement, but something along the lines of foo <-

[R] alternative for multiple if_else statements

2018-02-21 Thread Kevin Wamae
Hi, I am having trouble trying to figure out why if_else is behaving the way it is, it may be my code or the way the data is structured. Below is a snapshot of a database am working on and it represents a longitudinal survey of study participants in a trial with weekly follow up. The variable "

Re: [R] Populate one data frame with values from another dataframe for rows that match

2017-10-15 Thread Kevin Wamae
s.na<http://is.na/>(pf_mcl.y), pf_mcl.x, pf_mcl.y ) ) %>% dplyr::select( studyno, date, pf_mcl ) Regards ------ Kevin Wamae From: Kevin Wamae Date: Sunday, 15 October 2017 at 14:03 To: William Dunlap Cc: Bert Gunter , Rui Barradas , Eric Berger , R-help Sub

Re: [R] Populate one data frame with values from another dataframe for rows that match

2017-10-15 Thread Kevin Wamae
tching rows within the raw dataset. @Eric<mailto:ericjber...@gmail.com>’s solution was able to achieve that. Nonetheless, we do appreciate your solution. Regards ------ Kevin Wamae From: William Dunlap Date: Saturday, 14 October 2017 at 20:21 To: Kevin Wamae Cc: Bert Gunter ,

Re: [R] Populate one data frame with values from another dataframe for rows that match

2017-10-14 Thread Kevin Wamae
, 14 October 2017 at 12:43 To: Kevin Wamae Cc: Rui Barradas , "r-help@r-project.org" Subject: Re: [R] Populate one data frame with values from another dataframe for rows that match Hi Kevin, I think there are issues with Rui's proposed solution. For example, if there are rows in

Re: [R] Populate one data frame with values from another dataframe for rows that match

2017-10-13 Thread Kevin Wamae
- which(names(myDF1) == "pf_mcl") merge(myDF1[-i1], myDF2, by = "studyno") Hope this helps, Rui Barradas Em 13-10-2017 20:09, Kevin Wamae escreveu: > I'm trying to populate the column “pf_mcl” in myDF1 with values from myDF2, whe

Re: [R] Populate one data frame with values from another dataframe for rows that match

2017-10-13 Thread Kevin Wamae
Dear @Bert Gunter<mailto:bgunter.4...@gmail.com>, I tried merge and I faced many challenges. @Rui Barradas<mailto:ruipbarra...@sapo.pt> solution is working. From: Bert Gunter Date: Friday, 13 October 2017 at 22:44 To: Kevin Wamae Cc: R-help Subject: Re: [R] Populate one data frame

[R] Populate one data frame with values from another dataframe for rows that match

2017-10-13 Thread Kevin Wamae
I'm trying to populate the column “pf_mcl” in myDF1 with values from myDF2, where rows match based on column "studyno" but the solutions I have found so far don't seem to be giving me the desired output. Below is a snapshot of the data.frames. myDF1 <- structure(list(studyno = c("J1000/9", "J10

Re: [R] R - Populate Another Variable Based on Multiple Conditions | For a Large Dataset

2016-07-03 Thread Kevin Wamae
; you have the admin_period column that I showed you how to make. > -- > Sent from my phone. Please excuse my brevity. > > On July 3, 2016 1:47:17 PM PDT, Kevin Wamae wrote: >>Hi Bert, my first task is to make a Kaplan Meier Plot to evaluate the >>risk of developing disease

Re: [R] R - Populate Another Variable Based on Multiple Conditions | For a Large Dataset

2016-07-03 Thread Kevin Wamae
ave if you have the admin_period column that I showed you how to make. -- Sent from my phone. Please excuse my brevity. On July 3, 2016 1:47:17 PM PDT, Kevin Wamae wrote: >Hi Bert, my first task is to make a Kaplan Meier Plot to evaluate the >risk of developing disease in the treated vs the n

Re: [R] R - Populate Another Variable Based on Multiple Conditions | For a Large Dataset

2016-07-03 Thread Kevin Wamae
loom County" comic strip ) On Sun, Jul 3, 2016 at 1:08 PM, Kevin Wamae wrote: > Hi Jeff, It works on well on a dataset with 10 rows and I figure it will > work well with the “real” dataset. You’ve been of great help and I am > starting to make headway. > > It creates a ne

Re: [R] R - Populate Another Variable Based on Multiple Conditions | For a Large Dataset

2016-07-03 Thread Kevin Wamae
, by = c( ID="ID", admin_period ="admin_period1" ) ) %>% mutate( ddays = end - start ) ) -- Sent from my phone. Please excuse my brevity. On July 3, 2016 11:55:14 AM PDT, Kevin Wamae wrote: >Hi Jeff, “likes its

Re: [R] R - Populate Another Variable Based on Multiple Conditions | For a Large Dataset

2016-07-03 Thread Kevin Wamae
Thanks Jeff, let me try it on the larger dataset. Regards --- Kevin Wame On 7/3/16, 10:09 PM, "Jeff Newmiller" wrote: result <- ( result0 %>% select( -admin_period1 ) %>% inner_join( result0 %>

Re: [R] R - Populate Another Variable Based on Multiple Conditions | For a Large Dataset

2016-07-03 Thread Kevin Wamae
HI Jeff, it’s been an uphill task working with the dataset and I am not the first to complain. Nonetheless, data-cleaning is ongoing and since I cannot wait for that to get done, I decided to make the most of what the dataset looks like at this time. It appears the process may take a while. Tha

Re: [R] R - Populate Another Variable Based on Multiple Conditions | For a Large Dataset

2016-07-03 Thread Kevin Wamae
[1] http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example -- Sent from my phone. Please excuse my brevity. On July 2, 2016 3:41:07 PM PDT, Kevin Wamae wrote: >Hi Jeff, sorry for referring to you as Jennifer earlier, accept my >apol

Re: [R] R - Populate Another Variable Based on Multiple Conditions | For a Large Dataset

2016-07-02 Thread Kevin Wamae
my brevity. On July 2, 2016 2:57:39 AM PDT, Kevin Wamae wrote: >I have a drug-trial study dataset (attached image). > >Since its a large and complex dataset (at least to me) and I hope to be >as clear as possible with my question. >The dataset is from a study where individuals are giv

[R] R - Populate Another Variable Based on Multiple Conditions | For a Large Dataset

2016-07-02 Thread Kevin Wamae
I have a drug-trial study dataset (attached image). Since its a large and complex dataset (at least to me) and I hope to be as clear as possible with my question. The dataset is from a study where individuals are given drugs and followed up over a period spanning two consecutive years. Individua