readxl (1)

R에서 데이터 가져오기 소개

Filip Schouwenaars

Instructor, DataCamp

Microsoft Excel

  • 대표적인 데이터 분석 도구
  • Excel과 연동되는 다양한 R 패키지
  • readxl - Hadley Wickham
R에서 데이터 가져오기 소개

Excel 데이터의 일반적인 구조

  • 표 형식 데이터가 담긴 여러 시트

Excel 데이터 구조 예시 화면

R에서 데이터 가져오기 소개

readxl

  • excel_sheets()
    • 시트 목록 확인
  • read_excel()
    • 데이터를 R로 불러오기
install.packages("readxl")
library(readxl)
R에서 데이터 가져오기 소개

excel_sheets()

dir()
"cities.xlsx"  "the_rest_is_secret.txt"
excel_sheets("cities.xlsx")
"year_1990" "year_2000"
R에서 데이터 가져오기 소개

read_excel()

read_excel("cities.xlsx")
# A tibble: 4 × 2
    Capital Population
      <chr>      <dbl>
1  New York   16044000
2    Berlin    3433695
3    Madrid    3010492
4 Stockholm    1683713
read_excel("cities.xlsx", sheet = 2)
read_excel("cities.xlsx", sheet = "year_2000")
# A tibble: 4 × 2
    Capital Population
      <chr>      <dbl>
1  New York   17800000
2    Berlin    3382169
3    Madrid    2938723
4 Stockholm    1942362
R에서 데이터 가져오기 소개

연습해 봅시다!

R에서 데이터 가져오기 소개

Preparing Video For Download...