Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I'm using RStudio, and trying to knit my file to hand in my assignment. I installed the package "readxl" to read in a couple of excel files, and it worked fine in the actual coding of the assignment. But when I go to knit the file, I keep getting the error:

Error in library(readxl) : there is no package called 'readxl'
Calls: <Anonymous> ... withCallingHandlers -> withVisible -> eval -> eval -> 
library
Execution halted

This is the code in question:

install.packages("tidyverse",repos = "http://cran.us.r-project.org")
library(tidyverse)
install.packages("readxl",repos = "http://cran.us.r-project.org")
library(readxl)

This has been frustrating me for over an hour and I just can't fix it. I can see the readxl package to the right of the console, in the "packages" tab. Any help will be much appreciated

Has readxl been successfully installed? When you do library(readxl) are there any errors? Does readxl show up in sessionInfo()? – Maurits Evers Oct 26, 2017 at 1:37 Yes to every question. Package installed successfully, library correctly attached. readxl comes up in the "other packages" section of sessionInfo() – user8834671 Oct 26, 2017 at 1:48 I've seen this happen after updating packages in RStudio without restarting the session. Try restarting RStudio? – neilfws Oct 26, 2017 at 2:22 I generally wouldn't include install.packages() calls in an Rmarkdown document - no need to reinstall the package every time you knit the document. Have you tried removing the install.packages calls? – Marius Oct 26, 2017 at 3:02

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.