Not sure if this might be the reason for you but I have also faced a similar kind of issue.
Maybe you have manipulated your data in the environment but not in the same way in the script of the knit file. Double-check your codes how data is read and what steps are used to create objects on the knit file.