cas.read.xlsx: Read an XLSX File and Upload to a CAS Table

View source: R/read_write.R

cas.read.xlsxR Documentation

Read an XLSX File and Upload to a CAS Table

Description

This function is a convenience wrapper for the R read.xlsx and as.casTable functions. After reading the file that is accessible to the R client, it is uploaded to an in-memory table in CAS (the server).

Usage

cas.read.xlsx(
  conn,
  file,
  sheetIndex = 1,
  sheetName = NULL,
  rowIndex = NULL,
  startRow = NULL,
  endRow = NULL,
  colIndex = NULL,
  as.data.frame = TRUE,
  header = TRUE,
  colClasses = NA,
  keepFormulas = FALSE,
  encoding = "unknown",
  casOut = list(name = "", replace = FALSE)
)

Arguments

conn

An instance of a CAS object that represents a connection and CAS session.

file

An character string that specifies the filename for the XLSX file. This value is passed to read.xslx.

sheetIndex

An optional numeric that specifies the sheet in the workbook. This value is passed to read.xlsx.

sheetName

An optional character string that specifies the sheet name in the workbook. This value is passed to read.xlsx.

rowIndex

An optional numeric vector that specifies the rows to read from the workbook. By default, all rows are read. This value is passed to read.xlsx.

startRow

An optional numeric that specifies the first row of the workbook to read. This value is ignored of rowIndex is specified. This value is passed to read.xlsx.

endRow

An optional numeric that specifies the last row of the workbook to read. This value is ignored if rowIndex is specified. This value is passed to read.xlsx.

colIndex

An optional numeric vector that specifies the variables to read from the workbook. By default, all variables are read. This value is passed to read.xlsx.

as.data.frame

An optional logical value that specifies whether the data should be coerced into a data frame. This value is passed to read.xlsx.

header

An optional logical that specifies whether the first line of the file contains variable names.

colClasses

An optional character vector that specifies the classes for the columns. This value is passed to read.xlsx.

keepFormulas

An optional logical value that specifies whether Excel formulas are included as text or if they are evaluated and the result is read as data. This value is passed to read.xlsx.

encoding

An optional character string that specifies the encoding for character data. This value is passed to read.xlsx.

casOut

An optional character or list. If you specify a string, then the string is used as the in-memory table name. A list can be used to specify properties for the in-memory table as follows:

name

An optional character that specifies the name for the in-memory table. By default, the name of the data frame is used.

caslib

An optional character that specifies the caslib. Specify this parameter to override the active caslib.

label

An optional character that specifies a descriptive label for the data.

replace

An optional logical. When set to TRUE, you can replace an existing in-memory table with the same name in the same caslib. The default value is FALSE.

promote

An optional logical. When set to TRUE, the in-memory table has global scope and can be available to other CAS sessions (subject to access controls). The default value is FALSE and the in-memory table has session scope so that it is accessible with the session that uploaded the table only. Session-scope tables are ideal for data analysis. Global-scope tables are better suited for reporting.

replication

An optional numeric that specifies the number of redundant copies of in-memory blocks. This parameter applies to distributed servers only. The default value is 1.

Value

CASTable

See Also

Other functions for loading in-memory data: cas.read.csv(), cas.read.jmp(), cas.read.sas7bdat(), cas.read.table(), cas.readRDS()

Examples

## Not run: 
myCasTable <- cas.read.xlsx(s, file="/path/to/data_out.xlsx", 
  sheetIndex = 1, 
  casOut=list(name="mycastable", replace=TRUE))

## End(Not run)

sassoftware/R-swat documentation built on Feb. 26, 2024, 8 a.m.