search for: date_flag

Displaying 5 results from an estimated 5 matches for "date_flag".

2017 Aug 23
0
Comparing 2 dale columns
...ifferent values of the dataframe "data" in each instance. # I understand you have done something like the following: data <- data.frame(COL1 = c("6/1/14", "7/1/14"), COL2 = c("5/1/15", "5/1/15"), stringsAsFactors = FALSE) data$Date_Flag <- ifelse(data$COL2 > data$COL1, 0,1) data data$COL2 <- as.Date(as.character(data$COL2, format = "%y/%m/%d")) data$COL1 <- as.Date(as.character(data$COL1, format = "%y/%m/%d")) data$Date_Flag <- ifelse(data$COL2 > data$COL1, 0,1) data # What you may want inste...
2017 Aug 23
2
Comparing 2 dale columns
Dear R fellows, I created a new column Date_flag to compare the dates of COL1 and COL2 using the code below. But it showed that 5/1/15 is greater than 6/1/2014 and 5/1/2015 greater than 7/1/2014 despite the year is greater. How do I fix that? I did try to format as %y/%m/%d but it does not fix that. data$Date_Flag <- ifelse(data$COL2 >...
2017 Aug 23
2
Comparing 2 dale columns
...riginal Message----- > From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Patrick > Casimir > Sent: Wednesday, August 23, 2017 4:54 PM > To: r-help at r-project.org > Subject: [R] Comparing 2 dale columns > > Dear R fellows, > > > I created a new column Date_flag to compare the dates of COL1 and COL2 > using the code below. But it showed that 5/1/15 is greater than 6/1/2014 and > 5/1/2015 greater than > 7/1/2014 despite the year is greater. How do I fix that? I did try to format as > %y/%m/%d > > but it does not fix that. > > > d...
2017 Aug 23
0
Comparing 2 dale columns
...riginal Message----- > From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Patrick > Casimir > Sent: Wednesday, August 23, 2017 4:54 PM > To: r-help at r-project.org > Subject: [R] Comparing 2 dale columns > > Dear R fellows, > > > I created a new column Date_flag to compare the dates of COL1 and COL2 > using the code below. But it showed that 5/1/15 is greater than 6/1/2014 and > 5/1/2015 greater than > 7/1/2014 despite the year is greater. How do I fix that? I did try to format as > %y/%m/%d > > but it does not fix that. > > > d...
2017 Aug 22
5
Convert Factor to Date
Dear R Fellows, I Have a dataset( data1) with 2 columns of date showing a class of factor. How to convert them to date? Then compare them, keep the greater date only in a new column. Using as.Date to change the class to Date but the data becomes NA. Much Thanks COL1 COL2 Apr-16 1-Nov-16 May-16 1-Nov-16 Jun-16 1-Nov-16 Jul-16 1-Nov-16 Aug-16 1-Nov-16 Sep-16 1-Nov-16 Oct-16 1-Nov-16