xlW2L: Convert Execl Wide Table to Long Data Frame

Description Usage Arguments Value Examples

View source: R/xlW2L.R

Description

This function converts Execl Wide Table to Long Data Frame.

Usage

1
2
xlW2L(filePath, shtNum = 1, celIStart, cellEnd, x1cell, x1Name = "",
  yName = "")

Arguments

filePath

the Excel file with extension .xlsx, .xls, .xlsm, and .csv. If csv file is selected, other arguments are not needed.

shtNum

an Excel sheet number for data table, defaults to 1.

celIStart

an Excel data starting Cell Index (upper left corner), e.g., em218, eM218, EM218, or 218Em, 218em (with max.2-letter column header).

cellEnd

an Excel data ending Cell Index (bottom right corner), e.g., dW543 (with max.2-letter column header).

x1cell

an Excel Cell Index for cell with key header, which separates identification variables from Y-value varables, e.g., bf38 (with max.2-letter column header).

x1Name

optional key header, defaults to "" will use the original Excel key name if it exists.

yName

optional response variable name for y-values returned in Long Data Frame, defaults to "" will use "Y" for header of y-value column in Long Data Frame.

Value

xlW2L(..)$x1T or xlW2L(..)[1] – the original Excel table; xlW2L(..)wideF or xlW2L(..)[2] – the wide form after cleaning up; xlW2L(..)longF or xlW2L(..)[3] – the long data form. If the original file is .csv type, all three objects returned are the original csv table.

Examples

1
2
xlW2L(filePath,,"e8","o44","i8")$longF
xlW2L(filePath)$longF -- if original file is .cvs type, it returns the original cvs table.

tianqingliu/xlW2L documentation built on May 29, 2019, 12:17 p.m.