Displaying 6 results from an estimated 6 matches for "7cpatrcasi".
2017 Aug 22
1
Convert Factor to Date
...[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-help&data=02%7C01%7Cpatrcasi%40nova.edu%7C6abf3517ab5f407427d308d4e98e9efd%7C2c2b2d312e3e4df1b571fb37c042ff1b%7C0%7C0%7C636390246143633480&sdata=jwTeb%2BvH0bbkXdckgzE6PJZ3gDl9d1%2F3t9K%2BxDtjyls%3D&reserved=0
> PLEASE do read the posting guide https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.R-pro...
2017 Aug 22
0
Convert Factor to Date
On 2017-08-22 1:30 PM, Patrick Casimir wrote:
> 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.
????? When I specified a format with the second date, I got the desired
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
2017 Aug 23
2
Comparing 2 dale columns
...[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-help&data=02%7C01%7Cpatrcasi%40nova.edu%7Cbf182d25cae845ec841c08d4ea3a7139%7C2c2b2d312e3e4df1b571fb37c042ff1b%7C0%7C0%7C636390984126927971&sdata=Tait17GF8fuEBwFnDZHCgnc7v88yXqAxpTX7W76O1cA%3D&reserved=0
> PLEASE do read the posting guide https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.R-project.o...
2017 Aug 23
0
Comparing 2 dale columns
Hi
your code is wrong.
I get
> test<-read.table("clipboard", header=T)
> str(test)
'data.frame': 2 obs. of 2 variables:
$ COL1: Factor w/ 2 levels "6/1/14","7/1/14": 1 2
$ COL2: Factor w/ 1 level "5/1/15": 1 1
> test$COL2<- as.Date(as.character(test$COL2, format="%y/%m/%d"))
> test$COL1<-
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 > data$COL1, 0,1)
COL1 COL2
6/1/14