ez.readx: read an xlsx file, wrapper of 'read.xlsx'

View source: R/io.R

ez.readxR Documentation

read an xlsx file, wrapper of read.xlsx

Description

uses openxlsx package which does not require java and is much faster, but has a slightly different interface/parameters from xlsx package. internally trim (leading and trailing) string spaces

Usage

ez.readx(
  file,
  sheet = 1,
  tolower = FALSE,
  stringsAsFactors = FALSE,
  blanksAsNA = TRUE,
  na.strings = c("", "."),
  makenames = TRUE,
  detectDates = TRUE,
  ...
)

Arguments

sheet

The name or index of the sheet to read data from.

tolower

whether to convert all column names to lower case

stringsAsFactors

T/F

blanksAsNA

T/F, converts factor or character vector elements to NA if matching na.strings

na.strings

only applicable if blanksAsNA=T. e.g., c(”,'.','NA','na','N/A','n/a','NaN','nan')

makenames

if F, keep as is. if T, call make.names(unique=TRUE,allow_=TRUE) _ kept, The character "X" is prepended if necessary. All invalid characters are translated to "." .1 .2 etc appended for uniqueness

detectDates

If TRUE, attempt to recognise dates and perform conversion.

Value

when stringsAsFactors=T, in the returned data frame, string to factor
number stored as text in excel (->string) -> factor

Examples

read.xlsx(xlsxFile, sheet = 1, startRow = 1, colNames = TRUE,
         rowNames = FALSE, detectDates = FALSE, skipEmptyRows = TRUE,
         rows = NULL, cols = NULL, check.names = FALSE, namedRegion = NULL)

jerryzhujian9/zmisc documentation built on March 9, 2024, 12:49 a.m.