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

View source: R/read_write.R

cas.read.csvR Documentation

Read a CSV File and Upload to a CAS Table

Description

This function is a convenience wrapper for the R read.csv 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.csv(
  conn,
  file,
  header = TRUE,
  sep = ",",
  quote = "\"",
  dec = ".",
  fill = TRUE,
  comment.char = "",
  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 or connection for the data to read.

header

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

sep

A character that specifies the field delimiter. This value is passed to read.csv.

quote

A character string that specifies the characters that enclose character data type variables. This value is passed to read.csv.

dec

An optional character to represent the decimal separator. This value is passed to read.csv.

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.csv.

comment.char

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

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.

...

Optional parameters that are passed to read.csv.

Value

CASTable

See Also

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

Examples

## Not run: 
# Upload a CSV, the in-memory table is named HEART
heartct <- cas.read.csv(s, "http://support.sas.com/documentation/
  onlinedoc/viya/exampledatasets/heart.csv")

# Upload the same CSV, name the in-memory table HEARTCT
heartct <- cas.read.csv(s, "http://support.sas.com/documentation/
  onlinedoc/viya/exampledatasets/heart.csv",
  casOut=list(name="heartct", replace=TRUE))

## End(Not run)

sassoftware/R-swat documentation built on Feb. 19, 2025, 10:33 a.m.