Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Error in loadNamespace(x) : there is no package called ‘read_xl’

I am having trouble uploading sheets from my excel file into R. I followed another code I saw on how to read multiple sheets at once. The code I have used:

sheets <- read_xl::excel_sheets(filename.xlsx)
  x <- lapply(sheets, function(x) read_xl::read_excel(filename.xlsx, sheet = x))
  if(!tibble) x <- lapply(x, as.data.frame)
  names(x) <- sheets
  x
}

when i try to then run the following line of code:

mysheets <- read_xl_all_sheets("filename.xlsx")

I get: Error in loadNamespace(x) : there is no package called ‘read_xl’

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I have installed dplyr and called readxl from the library

What could be going wrong here?

>Solution :

If you import the library readxl

Then your code would look like this:

library(readxl)
sheets <- excel_sheets(filename.xlsx)
x <- lapply(sheets, function(x){ 
read_excel(filename.xlsx, sheet = x)})
if(!tibble) x <- lapply(x, as.data.frame)
names(x) <- sheets
x

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading