I am new at using R, but I am trying to learn how to use it to make my data analyses more reproducible. I have my dates entered in three columns for the drop off date and three columns for the pickup date (one for month, one for day, and one for year). I need to be able to get R to recognize it as a date, so I can calculate the time in field as a fraction of a year (days/365). I installed the lubridate package and tried using the mdy() function, but it gave me the following error message:
Error: Column `drop_off_date` must be length 150 (the number of rows) or one, not 450
In addition: Warning message:
All formats failed to parse. No formats found.
I also tried using backticks, but that did not work either. I think it may be because of how my dates are set up in different columns, but I am not sure. This is the section of code I used for that:
mutate(drop_off_date = mdy(dropoff_month, dropoff_day, dropoff_year),
pickup_date = mdy(pickup_month, pickup_day, pickup_year),
Does anyone have any suggestions for a different function or what I could fix to use this function?