Using Ifelse
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
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,
> 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
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 I checked the counts
of my new variable for accuracy, I found that
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
>
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,
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
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
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 per unique_id
as shown below.
unique_id visit_date
9 matches
Mail list logo