Part of my assignment involves taking the previous table I modified and adding a new variable that extracts the first 4 numbers of a previous variable for this new variable. For some reason, even after using mutate or transmute to add the variable without affecting the variables in the previous table, I am still getting an empty table. I am not sure where exactly the problem is.
This is my code so far:
salary4 = transmute(salary3, HireYear = str_sub(str(Hire), 1, 4))
salary4
The error I keep getting for this problem is this: "HireYear` must be size 13001 or 1, not 0"