Skip to content

Instantly share code, notes, and snippets.

@woons
Created March 7, 2019 07:45
Show Gist options
  • Save woons/e34fa3f73d354619ab98d4c190d3787f to your computer and use it in GitHub Desktop.
Save woons/e34fa3f73d354619ab98d4c190d3787f to your computer and use it in GitHub Desktop.
reading multiple csv files
#######################################################################
# 방법1
# 프로젝트 경로에 특정 폴더를 생성하고 그 안에 csv파일을 한번에 가져오고자 한다면
# 'data'란 이름의 폴더 안에 파일을 생성했음
#######################################################################
devtools::install_github("andrewbtran/muckrakr")
library(muckrakr)
df <- bulk_csv(folder = "data")
#######################################################################
# 방법2
# map_df함수 활용 (csv 파일 path는 프로젝트 파일과 동일)
#######################################################################
files <- list.files(pattern = "*.csv")
df <- files %>%
map_df(~read_csv(.))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment