I have two data frames with date variables. The first data frame's date variable is type "Date" in YYYY-MM-DD format. The second data frame's date variable is type "integer" in YYYYMMDD format. I am trying to convert one, or both, date variables so I can merge the two data frames by each data frame's date variable. I realize this is a multi-step process, but I'm having difficulty with creating / converting to do the merge.
The first data frame has the following code: FF$FFReportDT<-(strptime(FF$Month,format="%Y-%m-%d")), the conversion of a YYYY-MM-DD formatted "Date" variable type to a POSIXLt variable type.
The second data frame has the following code:
lsHFIndex$FFReportDt <- strptime(lsHFIndex$ReportDt,"%Y%m%d")
....., the conversion of a YYYYMMDD formatted "Integer" variable type to a POSIXLt variable type.
When I do the merge with the following code:
lsHFIndexFF<-merge(lsHFIndex, FF, by.x="FFReportDt", by.y="FFReportDt")
I get the following error message: Error in fix.by(by.y, y) : 'by' must specify a uniquely valid column
Problem is when I look at each data frame's 'FFReportDt' variable, each looks good.
Where am I going wrong?