Re: [R] Creating New Variable Using Ifelse

2017-08-10 Thread Courtney Benjamin
Thanks very much; with your tips, I was able to get the nested ifelse statement to work properly! Courtney Benjamin From: PIKAL Petr Sent: Thursday, August 10, 2017 5:39 AM To: Courtney Benjamin; r-help@r-project.org Subject: RE: Creating New Variable U

Re: [R] Creating New Variable Using Ifelse

2017-08-10 Thread PIKAL Petr
Hi see in line > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Courtney > Benjamin > Sent: Thursday, August 10, 2017 5:55 AM > To: r-help@r-project.org > Subject: [R] Creating New Variable Using Ifelse > > Hello R Help List, > > I am an R novice and

Re: [R] Creating New Variable Using Ifelse

2017-08-09 Thread Ismail SEZEN
> On 10 Aug 2017, at 06:54, Courtney Benjamin wrote: > > Hello R Help List, > > I am an R novice and trying to use the ifelse function to create a new binary > variable based off of the responses of two other binary variables; NAs are > involved. I pulled it off almost successfully, but when

Re: [R] creating new variable

2012-09-24 Thread PIKAL Petr
Hi > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Niklas Fischer > Sent: Thursday, September 20, 2012 11:13 PM > To: r-help@r-project.org > Subject: [R] creating new variable > > Dear R-helper > > I have a data which is ab

Re: [R] Creating new variable with maximum visit date by group_id

2011-08-24 Thread Dennis Murphy
Hi: Since you tried several functions (reasonably so IMO), here is how they would work in this problem, in addition to the solutions already supplied. Some data massaging before starting, taking your data as input, saved into an object named visits: visits <- structure(list(unique_id = c(1L, 1L,

Re: [R] Creating new variable with maximum visit date by group_id

2011-08-24 Thread Jean V Adams
Try this: require(zoo) lvd <- tapply(df$visit_date, df$unique_id, max) index <- tapply(df$visit_date, df$unique_id) df$last_visit_date <- as.Date(lvd[index]) Jean Kathleen Rollet wrote on 08/24/2011 04:15:45 PM: > > Dear R users, > > I am encoutering the following problem: I have a dataset wit

Re: [R] Creating new variable with maximum visit date by group_id

2011-08-24 Thread David Winsemius
On Aug 24, 2011, at 5:15 PM, Kathleen Rollet wrote: Dear R users, I am encoutering the following problem: I have a dataset with a 'unique_id' and different 'visit_date' (formatted as.Date, "%d/%m/ %Y") per unique_id. I would like to create a new variable with the most recent date of visit