error object not found when knitting to word

i am very new to r programming how do i fix this error
-Error in read_xls("C:\Users\Benson\Downloads\cervical_cancer.xls") :
could not find function "read_xls"
Calls: ... withVisible -> eval_with_user_handlers -> eval -> eval
Execution halted
my code is running and file i am reading is already in the global environment but wont knit to word

When you knit an Rmd document the code gets executed in a clean environment other than the one you are currently working on so the mentioned function is not loaded there. You need to include the necessary code to load the package from where that function comes from, in your Rmd document itself, for example, if the function comes from the readxl package you would need to add a command like this: library(readxl).

1 Like

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.