hola
como puedo importar varios excel en una sola base de datos en r
son excel de exportaciones todos los excel tienen el mismo nombre es las columnas
One possible method:
library(dplyr)
library(openxlsx)
Archivos <- list.files(path = "~/R/Play/", pattern = ".xlsx", full.names = TRUE)
Lista <- lapply(Archivos, function(Nombre) read.xlsx(Nombre))
names(Lista) <- Archivos
DF <- bind_rows(Lista, .id = "Archivo")
1 Like
Anther option is to use purrr::map_dfr()
library(tidyverse)
library(openxlsx)
list_of_files <- list.files(path = "path/to/your/files",
pattern = "\\.xlsx$",
full.names = TRUE)
df <- list_of_files %>%
set_names() %>%
map_dfr(read.xlsx, .id = "file_name")
This topic was automatically closed 21 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.