Čtení listů

Introduction to Importing Data in R

Filip Schouwenaars

Instructor, DataCamp

Snímek obrazovky 2019-07-31 ve 22:03:48.png

Introduction to Importing Data in R

XLConnect

  • Martin Studer

  • Práce s Excelem přes R

  • Propojení Excelu a R

  • XLS a XLSX

  • Snadné použití

Introduction to Importing Data in R

Instalace

install.packages("XLConnect")
also installing the dependencies 'XLConnectJars', 'rJava'
...
  • Problémy?
    • Nainstalujte Oracle Java Development Kit (JDK)
    • Vyhledejte chybu na Googlu!
Introduction to Importing Data in R

loadWorkbook()

library("XLConnect")

book <- loadWorkbook("cities.xlsx")
str(book)
Formal class 'workbook' [package "XLConnect"] with 2 slots
  ..@ filename: chr "cities.xlsx"
  ..@ jobj    : ...
Introduction to Importing Data in R

getSheets()

getSheets(book)

"year_1990" "year_2000"

library(readxl)
excel_sheets("cities.xlsx")
"year_1990" "year_2000"
Introduction to Importing Data in R

readWorksheet()

readWorksheet(book, sheet = "year_2000")

    Capital Population
1  New York   17800000
2    Berlin    3382169
3    Madrid    2938723
4 Stockholm    1942362
Introduction to Importing Data in R

readWorksheet()

Snímek obrazovky 2019-07-31 ve 22:13:15.png

readWorksheet(book, sheet = "year_2000",                 
              startRow = 3, 
              endRow = 4,                 
              startCol = 2, 
              header = FALSE)

     Col1
1 3382169
2 2938723
Introduction to Importing Data in R

Pojďme cvičit!

Introduction to Importing Data in R

Preparing Video For Download...