[R] Convert Factor to Date

Patrick Casimir patrcasi at nova.edu
Tue Aug 22 20:30:51 CEST 2017


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
Nov-16  1-Nov-16
Dec-16  1-Nov-16
Jan-17  1-Nov-16
Feb-17  1-Nov-16
Mar-17  1-Nov-16
Apr-17  1-Nov-16
May-17  1-Nov-16
Jun-17  1-Nov-16
Jul-17  1-Nov-16
Aug-17  1-Nov-16
Sep-17  1-Nov-16


	[[alternative HTML version deleted]]



More information about the R-help mailing list