readxl v0.1.1

0

Monthly downloads

0th

Percentile

by Hadley Wickham

Read Excel Files

Import excel files into R. Supports '.xls' via the embedded 'libxls' C library (http://sourceforge.net/projects/libxls/) and '.xlsx' via the embedded 'RapidXML' C++ library (http://rapidxml.sourceforge.net). Works on Windows, Mac and Linux without external dependencies.

Readme

readxl

Travis-CI Build Status

The readxl package makes it easy to get data out of Excel and into R. Compared to many of the existing packages (e.g. gdata, xlsx, xlsReadWrite) readxl has no external dependencies so it's easy to install and use on all operating systems. It is designed to work with tabular data stored in a single sheet.

Readxl supports both the legacy .xls format and the modern xml-based .xlsx format. .xls support is made possible the with libxls C library, which abstracts away many of the complexities of the underlying binary format. To parse .xlsx, we use the RapidXML C++ library.

Installation

You can install:

  • the latest released version from CRAN with: *

    install.packages("readxl")
    
  • the latest development version from github with:

# install.packages("devtools")
devtools::install_github("hadley/readxl")

Usage

library(readxl)

# read_excel reads both xls and xlsx files
read_excel("my-old-spreadsheet.xls")
read_excel("my-new-spreadsheet.xlsx")

# Specify sheet with a number or name
read_excel("my-spreadsheet.xls", sheet = "data")
read_excel("my-spreadsheet.xls", sheet = 2)

# If NAs are represented by something other than blank cells,
# set the na argument
read_excel("my-spreadsheet.xls", na = "NA")

Features

  • Re-encodes non-ASCII characters to UTF-8.

  • Loads datetimes into POSIXct columns. Both Windows (1900) and Mac (1904) date specifications are processed correctly.

  • Blank columns and rows are automatically dropped.

  • It returns data frames with additional tbl_df class, so if you have dplyr loaded, you get nicer printing.

Example data

The package includes an example file created with openxlsx:

l <- list("iris" = iris, "mtcars" = mtcars, chickwts = chickwts, quakes = quakes)
openxlsx::write.xlsx(l, file = "inst/extdata/datasets.xlsx")

Functions in readxl

Name Description
read_excel Read xls and xlsx files.
excel_sheets List all sheets in an excel spreadsheet.
No Results!

Last month downloads

Details

License GPL-3 + file LICENSE
LazyData true
LinkingTo Rcpp
RoxygenNote 5.0.1
NeedsCompilation yes
Packaged 2016-03-28 19:47:20 UTC; hadley
Repository CRAN
Date/Publication 2016-03-28 23:26:14

Include our badge in your README

[![Rdoc](http://www.rdocumentation.org/badges/version/readxl)](http://www.rdocumentation.org/packages/readxl)