I have a data frame. One column (call this column a) contains years, like 1871, and another column (call this column b) contains months, like 2. I need to convert these year-month combinations, stored in these two date vectors, into a single serial date number. E.g. year 1871 and month 2, stored in different vectors, should return 683429. Meanwhile, when I check the class type of columns a and b, they are both integer.
In MATLAB this can easily be done using the syntax output = datenum(a,b,1) In R, I have tried the as.POSIXct function but did not succeed. I also tried the ISOdatetime function but that returned NA for all entries. It should be a simple operation but I cannot seem to figure it out. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.