Replace reshape2 with tidyr and simplify code
Correct typo