cas.read.table: Read a File and Upload to a CAS Table

cas.read.tableR Documentation

Read a File and Upload to a CAS Table

Description

This function is a convenience wrapper for the R read.table 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.table(
  conn,
  file,
  header = FALSE,
  sep = "",
  quote = "\"'",
  dec = ".",
  numerals = c("allow.loss", "warn.loss", "no.loss"),
  row.names,
  col.names,
  as.is = !stringsAsFactors,
  na.strings = "NA",
  colClasses = NA,
  nrows = -1,
  skip = 0,
  check.names = TRUE,
  fill = !blank.lines.skip,
  strip.white = FALSE,
  blank.lines.skip = TRUE,
  comment.char = "#",
  allowEscapes = FALSE,
  flush = FALSE,
  stringsAsFactors = default.stringsAsFactors(),
  fileEncoding = "",
  encoding = "unknown",
  text,
  skipNul = FALSE,
  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. This value is passed to read.table.

header

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

sep

An optional character that is used to specify the field delimiter for the file. This value is passed to write.table.

quote

An optional character string that specifies the characters that enclose character data. The value is passed to read.table.

dec

An optional character that specifies the decimal separator. This value is passed to read.table.

numerals

An optional character string that specifies how to interpret numbers that can lose precision due to the conversion from text to double precision. This value is passed to read.table.

row.names

An optional character vector of row names. This value is passed to read.table.

col.names

An optional character vector of names for the variables. The default is to use "V" followed by the column number. This value is passed to read.table.

as.is

An optional vector of logical, numeric, or character indices that specify the columns that are not converted to factors. This value is passed to read.table.

na.strings

An optional character vector that specifies the characters to interpret as NA. This value is passed to read.table.

colClasses

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

nrows

An optional numeric that specifies the maximum number of rows to read. This value is passed to read.table.

skip

An optional numeric that specifies the number of lines to skip in the file before reading data. This value is passed to read.table.

check.names

An optional logical that specifies whether variable names from the file are valid names. This value is passed to read.table.

fill

An optional logical value. When set to TRUE, blank fields are implicitly added for rows that have unequal length. This value is passed to read.table.

strip.white

An optional logical that specifies whether white space characters are stripped from character data that are not enclosed with quotation marks. This value is ignored unless sep is specified. This value is passed to read.table.

blank.lines.skip

An optional logical that specifies whether blank lines in the file are ignored. This value is passed to read.table.

comment.char

An optional character that specifies the character to interpret as the beginning of a comment. This value is passed to read.table.

allowEscapes

An optional logical that specifies whether C-style escape characters such as \n are interpreted or are read verbatim. This value is passed to read.table.

flush

An optional logical that specifies whether input that follows the last field to read is flushed. Setting this argument to TRUE enables adding comments to the end of data lines. This value is passed to read.table.

stringsAsFactors

An optional logical that specifies whether character vectors are converted to factors. This argument is overridden by as.is and colClasses. This value is passed to read.table.

fileEncoding

An optional character string that specifies the encoding to use for reading the file. This value is passed to read.table.

encoding

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

text

An optional character string. This value is passed to read.table.

skipNul

An optional logical that is passed to read.table.

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.xlsx(), cas.readRDS()

Examples

## Not run: 
myCasTable <- cas.read.table(s, "/path/to/data.tsv", header=TRUE,
                             sep="\t", casOut=list(name="mycastable"))

## End(Not run)

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