I have a data set with a character column for months (MONTH
) and a numeric column indicating years (YEAR
). In order to work with it as panel data, I need to unite these YEAR
and MONTH
into a variable with a date format.
I have tried to change the variable MONTH
to numeric format and then to merge MONTH
with the column YEAR
. R would not recognize it as a date variable.
It currently looks like this:
STATE MONTH YEAR VALUE
California JAN 2018 800
California FEB 2018 780
California MAR 2018 600
... ... ... ...
Minesota JAN 2018 800
Minesota FEB 2018 780
Minesota MAR 2018 600
... ... ... ...
I want it like this:
STATE TIME VALUE
California 01-2018 800
California 02-2018 780
California 03-2018 600
... ... ...
Minesota 01-2018 800
Minesota 02-2018 780
Minesota 03-2018 600
... ... ...