I needed had messed up the variable months in the function (forgot the s). I changed that. It doesn't work on vectors, so I don't know if we can use it on our dataframe.