Чтение и загрузка нескольких листов Excel в R - PullRequest
0 голосов
/ 07 марта 2019

Я хочу прочитать и загрузить файл Excel в свою среду, я просто получаю список.

path <- "data/data.xlsx"

path %>% 
  excel_sheets() %>% 
  set_names() %>% 
  map(read_excel, path = path)

1 Ответ

1 голос
/ 08 марта 2019

Вы можете попробовать: Для этого примера я сделал xlsx с 3 листами.

library(readxl)
# Get the sheets count
sheets <- excel_sheets("some.xlsx")

for (i in 1 : length(sheets)) {

 shts <- paste("x", i, sep = ".")
 # Read every single sheet and assign to variable x1, x2, x3 etc...
 assign(shts, read_excel("c:/Temporal/TEST.xlsx", sheet=sheets[i]))
}

Результат:

enter image description here

Надеюсь, это поможет!

...