| Title: | SAS Scripting Wrapper for Analytics Transfer (SWAT) |
|---|---|
| Description: | SWAT provides an R scripting interface to SAS Cloud Analytic Services (CAS). This enables R programmers to perform analytical functions provided by SAS. |
| Authors: | Jared Dean [aut, cre], Tom Weber [aut, cre], Kevin Smith [aut] |
| Maintainer: | Kevin Smith <[email protected]> |
| License: | file LICENSE |
| Version: | 1.10.0.9000 |
| Built: | 2026-05-27 08:02:09 UTC |
| Source: | https://github.com/pinduzera/R-swat-universe |
Extract Columns from a CAS Table
## S4 method for signature 'CASTable' x[i, j, ..., drop = TRUE] ## S4 replacement method for signature 'CASTable' x[i, j, ...] <- value ## S4 method for signature 'CASTable' x[[i]] ## S4 method for signature 'CASTable' x$name ## S4 replacement method for signature 'CASTable' x$name <- value .cas.arith(e1, op, e2) ## S4 method for signature 'CASTable,CASTable' e1 - e2 ## S4 method for signature 'CASTable,ANY' e1 - e2 ## S4 method for signature 'ANY,CASTable' e1 - e2 ## S4 method for signature 'CASTable,CASTable' e1 + e2 ## S4 method for signature 'CASTable,ANY' e1 + e2 ## S4 method for signature 'ANY,CASTable' e1 + e2 ## S4 method for signature 'CASTable,CASTable' e1 / e2 ## S4 method for signature 'CASTable,ANY' e1 / e2 ## S4 method for signature 'ANY,CASTable' e1 / e2 ## S4 method for signature 'CASTable,CASTable' e1 * e2 ## S4 method for signature 'CASTable,ANY' e1 * e2 ## S4 method for signature 'ANY,CASTable' e1 * e2 ## S4 method for signature 'CASTable,CASTable' e1 ^ e2 ## S4 method for signature 'CASTable,ANY' e1 ^ e2 ## S4 method for signature 'ANY,CASTable' e1 ^ e2 ## S4 method for signature 'CASTable,CASTable' e1 %% e2 ## S4 method for signature 'CASTable,ANY' e1 %% e2 ## S4 method for signature 'ANY,CASTable' e1 %% e2 ## S4 method for signature 'CASTable,CASTable' e1 %/% e2 ## S4 method for signature 'CASTable,ANY' e1 %/% e2 ## S4 method for signature 'ANY,CASTable' e1 %/% e2 .cas.compare(e1, op, e2) ## S4 method for signature 'CASTable,CASTable' e1 > e2 ## S4 method for signature 'CASTable,ANY' e1 > e2 ## S4 method for signature 'ANY,CASTable' e1 > e2 ## S4 method for signature 'CASTable,CASTable' e1 < e2 ## S4 method for signature 'CASTable,ANY' e1 < e2 ## S4 method for signature 'ANY,CASTable' e1 < e2 ## S4 method for signature 'CASTable,CASTable' e1 >= e2 ## S4 method for signature 'CASTable,ANY' e1 >= e2 ## S4 method for signature 'ANY,CASTable' e1 >= e2 ## S4 method for signature 'CASTable,CASTable' e1 <= e2 ## S4 method for signature 'CASTable,ANY' e1 <= e2 ## S4 method for signature 'ANY,CASTable' e1 <= e2 ## S4 method for signature 'CASTable,CASTable' e1 == e2 ## S4 method for signature 'CASTable,ANY' e1 == e2 ## S4 method for signature 'ANY,CASTable' e1 == e2 ## S4 method for signature 'CASTable,CASTable' e1 != e2 ## S4 method for signature 'CASTable,ANY' e1 != e2 ## S4 method for signature 'ANY,CASTable' e1 != e2 .cas.logic(e1, op, e2) ## S4 method for signature 'CASTable,CASTable' e1 & e2 ## S4 method for signature 'CASTable,ANY' e1 & e2 ## S4 method for signature 'ANY,CASTable' e1 & e2 ## S4 method for signature 'CASTable,CASTable' e1 | e2 ## S4 method for signature 'CASTable,ANY' e1 | e2 ## S4 method for signature 'ANY,CASTable' e1 | e2 ## S4 method for signature 'CASTable' !x## S4 method for signature 'CASTable' x[i, j, ..., drop = TRUE] ## S4 replacement method for signature 'CASTable' x[i, j, ...] <- value ## S4 method for signature 'CASTable' x[[i]] ## S4 method for signature 'CASTable' x$name ## S4 replacement method for signature 'CASTable' x$name <- value .cas.arith(e1, op, e2) ## S4 method for signature 'CASTable,CASTable' e1 - e2 ## S4 method for signature 'CASTable,ANY' e1 - e2 ## S4 method for signature 'ANY,CASTable' e1 - e2 ## S4 method for signature 'CASTable,CASTable' e1 + e2 ## S4 method for signature 'CASTable,ANY' e1 + e2 ## S4 method for signature 'ANY,CASTable' e1 + e2 ## S4 method for signature 'CASTable,CASTable' e1 / e2 ## S4 method for signature 'CASTable,ANY' e1 / e2 ## S4 method for signature 'ANY,CASTable' e1 / e2 ## S4 method for signature 'CASTable,CASTable' e1 * e2 ## S4 method for signature 'CASTable,ANY' e1 * e2 ## S4 method for signature 'ANY,CASTable' e1 * e2 ## S4 method for signature 'CASTable,CASTable' e1 ^ e2 ## S4 method for signature 'CASTable,ANY' e1 ^ e2 ## S4 method for signature 'ANY,CASTable' e1 ^ e2 ## S4 method for signature 'CASTable,CASTable' e1 %% e2 ## S4 method for signature 'CASTable,ANY' e1 %% e2 ## S4 method for signature 'ANY,CASTable' e1 %% e2 ## S4 method for signature 'CASTable,CASTable' e1 %/% e2 ## S4 method for signature 'CASTable,ANY' e1 %/% e2 ## S4 method for signature 'ANY,CASTable' e1 %/% e2 .cas.compare(e1, op, e2) ## S4 method for signature 'CASTable,CASTable' e1 > e2 ## S4 method for signature 'CASTable,ANY' e1 > e2 ## S4 method for signature 'ANY,CASTable' e1 > e2 ## S4 method for signature 'CASTable,CASTable' e1 < e2 ## S4 method for signature 'CASTable,ANY' e1 < e2 ## S4 method for signature 'ANY,CASTable' e1 < e2 ## S4 method for signature 'CASTable,CASTable' e1 >= e2 ## S4 method for signature 'CASTable,ANY' e1 >= e2 ## S4 method for signature 'ANY,CASTable' e1 >= e2 ## S4 method for signature 'CASTable,CASTable' e1 <= e2 ## S4 method for signature 'CASTable,ANY' e1 <= e2 ## S4 method for signature 'ANY,CASTable' e1 <= e2 ## S4 method for signature 'CASTable,CASTable' e1 == e2 ## S4 method for signature 'CASTable,ANY' e1 == e2 ## S4 method for signature 'ANY,CASTable' e1 == e2 ## S4 method for signature 'CASTable,CASTable' e1 != e2 ## S4 method for signature 'CASTable,ANY' e1 != e2 ## S4 method for signature 'ANY,CASTable' e1 != e2 .cas.logic(e1, op, e2) ## S4 method for signature 'CASTable,CASTable' e1 & e2 ## S4 method for signature 'CASTable,ANY' e1 & e2 ## S4 method for signature 'ANY,CASTable' e1 & e2 ## S4 method for signature 'CASTable,CASTable' e1 | e2 ## S4 method for signature 'CASTable,ANY' e1 | e2 ## S4 method for signature 'ANY,CASTable' e1 | e2 ## S4 method for signature 'CASTable' !x
This function is rarely used for programming. It is used by the package to associate CAS metadata with tabular data that is returned by CAS actions.
as.casDataFrame( df, name = "", label = "", title = "", attrs = list(), col.labels = "", col.formats = "", col.attrs = list(), col.sizes = list(), col.types = "", col.widths = 0 )as.casDataFrame( df, name = "", label = "", title = "", attrs = list(), col.labels = "", col.formats = "", col.attrs = list(), col.sizes = list(), col.types = "", col.widths = 0 )
casDataFrame
## Not run: cdf2 = as.casDataFrame(df3[1:4]) cdf = as.casDataFrame(iris) ## End(Not run)## Not run: cdf2 = as.casDataFrame(df3[1:4]) cdf = as.casDataFrame(iris) ## End(Not run)
Uploads an R data frame to CAS and returns a
CASTable object. The CASTable object
is a reference in R (the client) to the in-memory
table that is in CAS (the server).
as.casTable(conn, df, casOut = "")as.casTable(conn, df, casOut = "")
conn |
A |
df |
A |
casOut |
An optional
|
## Not run: s <- CAS('cloud.example.com', 5570) irisct <- as.casTable(s, iris) # Specify a name for the in-memory table. mtcarsct <- as.casTable(s, mtcars, casOut="mtcarsct") # Avoid replacing an existing in-memory table. mtcarsct <- as.casTable(s, mtcars, casOut=list(name="mtcarsct", replace=FALSE)) ## End(Not run)## Not run: s <- CAS('cloud.example.com', 5570) irisct <- as.casTable(s, iris) # Specify a name for the in-memory table. mtcarsct <- as.casTable(s, mtcars, casOut="mtcarsct") # Avoid replacing an existing in-memory table. mtcarsct <- as.casTable(s, mtcars, casOut=list(name="mtcarsct", replace=FALSE)) ## End(Not run)
When you connect to SAS Cloud Analytic Services (CAS), the SWAT package software generates an R function for each CAS action that is available on the server.
cas.actionSet.action(CASorCASTab, parameters...)cas.actionSet.action(CASorCASTab, parameters...)
CASorCASTab |
An instance of a |
parameters |
Actions accept a series of parameters in key=value pair format. The parameters are action-specific. See the product documentation. |
The following two functions are generated and correspond to the table.tableInfo and simple.summary actions:
cas.table.tableInfo(irisct)
cas.simple.summary(irisct)
For a list of all the CAS actions that are available with SAS Visual Analytics, SAS Visual Statistics, and SAS Visual Data Mining and Machine Learning, see the following URL:
Actions and Action Sets by Name and Product
For the latest product documentation for SAS Viya, see Documentation for SAS Viya.
An instance of this class represents a connection and session between the client (R) and the server (SAS Cloud Analytic Services).
hostname |
A |
port |
A |
protocol |
A
|
username |
A |
password |
A |
session |
A |
locale |
A |
authinfo |
A |
path |
Base path of the connection URL |
authcode |
Authorization code from SASLogon used to retrieve an OAuth token. |
A CAS object.
## Not run: # Use binary communication and credentals from the default authinfo location. s <- CAS('cloud.example.com', 5570) # Use HTTPS and credentials from the default authinfo location. s <- CAS('cloud.example.com', 8777, protocol='https') # Use binary or HTTP communication and credentials from an alternative authinfo. s <- CAS('cloud.example.com', 5570, protocol='auto', authinfo=~/alt.txt) # Use binary or HTTP communcation and specify credentials. s <- CAS('cloud.example.com', 8777, protocol='auto', username="sasdemo" password="!s3cret") ## End(Not run)## Not run: # Use binary communication and credentals from the default authinfo location. s <- CAS('cloud.example.com', 5570) # Use HTTPS and credentials from the default authinfo location. s <- CAS('cloud.example.com', 8777, protocol='https') # Use binary or HTTP communication and credentials from an alternative authinfo. s <- CAS('cloud.example.com', 5570, protocol='auto', authinfo=~/alt.txt) # Use binary or HTTP communcation and specify credentials. s <- CAS('cloud.example.com', 8777, protocol='auto', username="sasdemo" password="!s3cret") ## End(Not run)
Close a CAS connection while leaving the session alive
cas.close(conn)cas.close(conn)
CAS |
The CAS connection object |
Returns the number of nonmissing values in the input table by column.
cas.count(CASTable)cas.count(CASTable)
x |
CASTable. |
This function operates on numeric columns only.
casDataFrame
The result includes one row for each numeric variable and a column that is named N for the nonmissing count.
cas.nmiss to count missing values.
## Not run: cas.count(ct[1:4]) cas.count(ct$n2) ## End(Not run)## Not run: cas.count(ct[1:4]) cas.count(ct$n2) ## End(Not run)
Returns the corrected sum of squares of the values for each column in the input table.
cas.css(CASTable)cas.css(CASTable)
x |
CASTable. |
This function operates on numeric columns only.
vector
The result is a named numeric vector. You can access the corrected sum of squares by column name or index.
## Not run: x <- cas.css(irisct) x['Sepal.Length'] x[1:2] ## End(Not run)## Not run: x <- cas.css(irisct) x['Sepal.Length'] x[1:2] ## End(Not run)
Returns the coefficient of variation of the values for each column in the input table.
cas.cv(CASTable)cas.cv(CASTable)
x |
CASTable. |
This function operates on numeric columns only.
vector
The result is a named numeric vector. You can access the coefficient of variation by column name or index.
## Not run: x <- cas.cv(irisct) x['Sepal.Length'] x[1:2] ## End(Not run)## Not run: x <- cas.cv(irisct) x['Sepal.Length'] x[1:2] ## End(Not run)
Returns the maximum value for each column in the input table.
cas.max(CASTable)cas.max(CASTable)
x |
CASTable. |
This function operates on numeric columns only.
casDataFrame
The result includes one row for each numeric variable and a column that is named Max for the maximum value.
max,CASTable-method
## Not run: cas.max(ct[1:4]) cas.max(ct$n2) ## End(Not run)## Not run: cas.max(ct[1:4]) cas.max(ct$n2) ## End(Not run)
Returns the mean value for each column in the input table.
cas.mean(CASTable)cas.mean(CASTable)
x |
CASTable. |
This function operates on numeric columns only.
casDataFrame
The result includes one row for each numeric variable and a column that is named Mean for the mean value.
mean,CASTable-method
## Not run: cas.mean(ct[1:4]) cas.mean(ct$n2) ## End(Not run)## Not run: cas.mean(ct[1:4]) cas.mean(ct$n2) ## End(Not run)
Returns the median value for each column in the input table.
cas.median(CASTable, q)cas.median(CASTable, q)
x |
CASTable. |
This function operates on numeric columns only.
data.frame
The result includes one row for each numeric variable and a column that is named Median for the median value.
median,CASTable-method
## Not run: cas.median(ct[1:4]) cas.median(ct$n2) ## End(Not run)## Not run: cas.median(ct[1:4]) cas.median(ct$n2) ## End(Not run)
Returns the minimum value for each column in the input table.
cas.min(CASTable)cas.min(CASTable)
x |
CASTable. |
This function operates on numeric columns only.
casDataFrame
The result includes one row for each numeric variable and a column that is named Minimum for the minimum value.
min,CASTable-method
## Not run: cas.min(ct[1:4]) cas.min(ct$n2) ## End(Not run)## Not run: cas.min(ct[1:4]) cas.min(ct$n2) ## End(Not run)
Returns the value that occurs most often for each column in the input table and the count for the value.
cas.mode(CASTable)cas.mode(CASTable)
x |
CASTable. |
This function operates on numeric and character columns.
data.frame
The result includes one row for each variable. One column is named Mode for the most common value. Another column is named Count to show the number of rows with the most common value.
## Not run: cas.mode(ct[1:4]) cas.mode(ct$n2) ## End(Not run)## Not run: cas.mode(ct[1:4]) cas.mode(ct$n2) ## End(Not run)
Returns the number of missing values in the input table by column.
cas.nmiss(CASTable)cas.nmiss(CASTable)
x |
CASTable. |
This function operates on numeric columns only.
vector
The result is a named numeric vector. You can access the count of missing values by column name or index.
cas.count to count nonmissing values.
## Not run: x <- cas.nmiss(irisct) x['Sepal.Length'] x[1:2] ## End(Not run)## Not run: x <- cas.nmiss(irisct) x['Sepal.Length'] x[1:2] ## End(Not run)
Returns the p-values for the values for each column in the input table.
cas.probt(CASTable)cas.probt(CASTable)
x |
CASTable. |
This function operates on numeric columns only.
vector
The result is a named numeric vector. You can access the p-value by column name or index.
## Not run: x <- cas.probt(irisct) x['Sepal.Length'] x[1:2] ## End(Not run)## Not run: x <- cas.probt(irisct) x['Sepal.Length'] x[1:2] ## End(Not run)
Returns the requested percentiles for each column in the input table.
cas.quantile(CASTable, q)cas.quantile(CASTable, q)
q |
A list of numeric values. |
x |
CASTable. |
This function operates on numeric columns only.
data.frame
The result includes one row for the variable, the requested percentile, and the value.
## Not run: cas.quantile(ct[1:4], q=50) cas.quantile(ct$n2, q=c(10, 25, 50, 75, 90)) ## End(Not run)## Not run: cas.quantile(ct[1:4], q=50) cas.quantile(ct$n2, q=c(10, 25, 50, 75, 90)) ## End(Not run)
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).
cas.read.csv( conn, file, header = TRUE, sep = ",", quote = "\"", dec = ".", fill = TRUE, comment.char = "", casOut = list(name = "", replace = FALSE), ... )cas.read.csv( conn, file, header = TRUE, sep = ",", quote = "\"", dec = ".", fill = TRUE, comment.char = "", casOut = list(name = "", replace = FALSE), ... )
conn |
An instance of a CAS object that represents a connection and CAS session. |
file |
An |
header |
An optional |
sep |
A |
quote |
A |
dec |
An optional |
fill |
An optional |
comment.char |
An optional |
casOut |
An optional
|
... |
Optional parameters that are passed to
|
Other functions for loading in-memory data:
cas.read.jmp(),
cas.read.sas7bdat(),
cas.read.table(),
cas.read.xlsx(),
cas.readRDS()
## 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)## 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)
This function transfers a JMP file (.jmp) from R (the client) to the CAS server. The server imports the data and R returns a CASTable object to reference the in-memory table in CAS.
cas.read.jmp(conn, file, casOut = NULL)cas.read.jmp(conn, file, casOut = NULL)
conn |
An instance of a CAS object that represents a connection and CAS session. |
file |
An |
casOut |
An optional
|
Other functions for loading in-memory data:
cas.read.csv(),
cas.read.sas7bdat(),
cas.read.table(),
cas.read.xlsx(),
cas.readRDS()
## Not run: spring_example <- cas.read.jmp(s, "/path/to/Spring\ Example.jmp", casOut=list(name="spring_example")) ## End(Not run)## Not run: spring_example <- cas.read.jmp(s, "/path/to/Spring\ Example.jmp", casOut=list(name="spring_example")) ## End(Not run)
This function transfers a SAS data set (.sas7bdat) file from R (the client) to the CAS server. The server imports the data and R returns a CASTable object to reference the in-memory table in CAS.
cas.read.sas7bdat(conn, file, casOut = list(name = "", replace = FALSE))cas.read.sas7bdat(conn, file, casOut = list(name = "", replace = FALSE))
conn |
An instance of a CAS object that represents a connection and CAS session. |
file |
An |
casOut |
An optional
|
Other functions for loading in-memory data:
cas.read.csv(),
cas.read.jmp(),
cas.read.table(),
cas.read.xlsx(),
cas.readRDS()
## Not run: gold_medals <- cas.read.sas7bdat(s, "/path/to/gold_medals.sas7bdat") ## End(Not run)## Not run: gold_medals <- cas.read.sas7bdat(s, "/path/to/gold_medals.sas7bdat") ## End(Not run)
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).
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) )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) )
conn |
An instance of a CAS object that represents a connection and CAS session. |
file |
An |
header |
An optional |
sep |
An optional |
quote |
An optional |
dec |
An optional |
numerals |
An optional |
row.names |
An optional |
col.names |
An optional |
as.is |
An optional vector of |
na.strings |
An optional |
colClasses |
An optional |
nrows |
An optional |
skip |
An optional |
check.names |
An optional |
fill |
An optional |
strip.white |
An optional |
blank.lines.skip |
An optional |
comment.char |
An optional |
allowEscapes |
An optional |
flush |
An optional |
stringsAsFactors |
An optional |
fileEncoding |
An optional |
encoding |
An optional |
text |
An optional |
skipNul |
An optional |
casOut |
An optional
|
Other functions for loading in-memory data:
cas.read.csv(),
cas.read.jmp(),
cas.read.sas7bdat(),
cas.read.xlsx(),
cas.readRDS()
## Not run: myCasTable <- cas.read.table(s, "/path/to/data.tsv", header=TRUE, sep="\t", casOut=list(name="mycastable")) ## End(Not run)## Not run: myCasTable <- cas.read.table(s, "/path/to/data.tsv", header=TRUE, sep="\t", casOut=list(name="mycastable")) ## End(Not run)
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).
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) )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) )
conn |
An instance of a CAS object that represents a connection and CAS session. |
file |
An |
sheetIndex |
An optional |
sheetName |
An optional |
rowIndex |
An optional |
startRow |
An optional |
endRow |
An optional |
colIndex |
An optional |
as.data.frame |
An optional |
header |
An optional |
colClasses |
An optional |
keepFormulas |
An optional |
encoding |
An optional |
casOut |
An optional
|
Other functions for loading in-memory data:
cas.read.csv(),
cas.read.jmp(),
cas.read.sas7bdat(),
cas.read.table(),
cas.readRDS()
## Not run: myCasTable <- cas.read.xlsx(s, file="/path/to/data_out.xlsx", sheetIndex = 1, casOut=list(name="mycastable", replace=TRUE)) ## End(Not run)## Not run: myCasTable <- cas.read.xlsx(s, file="/path/to/data_out.xlsx", sheetIndex = 1, casOut=list(name="mycastable", replace=TRUE)) ## End(Not run)
This function is a convenience wrapper for
the R readRDS 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).
cas.readRDS( conn, file, refhook = NULL, casOut = list(name = "", replace = FALSE) )cas.readRDS( conn, file, refhook = NULL, casOut = list(name = "", replace = FALSE) )
conn |
An instance of a CAS object that represents a connection and CAS session. |
file |
An |
refhook |
An optional value that is passed to
|
casOut |
An optional
|
Other functions for loading in-memory data:
cas.read.csv(),
cas.read.jmp(),
cas.read.sas7bdat(),
cas.read.table(),
cas.read.xlsx()
## Not run: myCasTable <- cas.readRDS(s, file="/path/to/data_out.rds", casOut=list(name="mycastable")) ## End(Not run)## Not run: myCasTable <- cas.readRDS(s, file="/path/to/data_out.rds", casOut=list(name="mycastable")) ## End(Not run)
This function downloads an in-memory table from the
CAS server and saves it as an RDS file that is accessible
to R (the client). This function is a convenience
wrapper for the R saveRDS function.
cas.saveRDS( CASTable, file = "", ascii = FALSE, version = NULL, compress = TRUE, refhook = NULL )cas.saveRDS( CASTable, file = "", ascii = FALSE, version = NULL, compress = TRUE, refhook = NULL )
CASTable |
The instance of the CASTable to save as as an RDS file. |
file |
An |
ascii |
An optional |
version |
An optional |
compress |
An optional |
refhook |
An optional value that is passed to
|
Other functions for saving in-memory data:
cas.write.csv(),
cas.write.table(),
cas.write.xlsx()
## Not run: cas.saveRDS(myCasTable, file="/path/to/data_out.rds") ## End(Not run)## Not run: cas.saveRDS(myCasTable, file="/path/to/data_out.rds") ## End(Not run)
Returns the standard deviation of the values for each column in the input table.
cas.sd(CASTable, na.rm = TRUE)cas.sd(CASTable, na.rm = TRUE)
na.rm |
An optional |
x |
CASTable. |
This function operates on numeric columns only.
casDataFrame
The result includes one row for each numeric variable and a column that is named Std for the standard deviation.
## Not run: cas.sd(ct[1:4]) cas.sd(ct$n2) ## End(Not run)## Not run: cas.sd(ct[1:4]) cas.sd(ct$n2) ## End(Not run)
Returns the standard error of the values for each column in the input table.
cas.stderr(CASTable)cas.stderr(CASTable)
x |
CASTable. |
This function operates on numeric columns only.
vector
The result is a named numeric vector. You can access the standard error by column name or index.
## Not run: x <- cas.stderr(irisct) x['Sepal.Length'] x[1:2] ## End(Not run)## Not run: x <- cas.stderr(irisct) x['Sepal.Length'] x[1:2] ## End(Not run)
Returns the sum of the values for each column in the input table.
cas.sum(CASTable)cas.sum(CASTable)
x |
CASTable. |
This function operates on numeric columns only.
casDataFrame
The result includes one row for each numeric variable and a column that is named Sum for the summed value.
colSums,CASTable-method
## Not run: cas.sum(ct[1:4]) cas.sum(ct$n2) ## End(Not run)## Not run: cas.sum(ct[1:4]) cas.sum(ct$n2) ## End(Not run)
End a CAS session and close the connection
cas.terminate(conn)cas.terminate(conn)
CAS |
The CAS connection object |
Returns the t-statistic for the values for each column in the input table.
cas.tvalue(CASTable)cas.tvalue(CASTable)
x |
CASTable. |
This function operates on numeric columns only.
vector
The result is a named numeric vector. You can access the t-statistic by column name or index.
## Not run: x <- cas.tvalue(irisct) x['Sepal.Length'] x[1:2] ## End(Not run)## Not run: x <- cas.tvalue(irisct) x['Sepal.Length'] x[1:2] ## End(Not run)
Upload a data.frame or file to a CAS table
cas.upload(conn, ...)cas.upload(conn, ...)
... |
Optional parameters that are passed to the table.loadtable action. |
CAS |
The CAS connection object |
data.frame/character |
The data.frame, filename, or URL to upload. |
list
Upload a data file to a CAS table
cas.upload.file(conn, ...)cas.upload.file(conn, ...)
... |
Optional parameters that are passed to the table.loadtable action. |
CAS |
The CAS connection object |
character |
The filename to upload |
Upload a data.frame to a CAS table
cas.upload.frame(conn, ...)cas.upload.frame(conn, ...)
... |
Optional parameters that are passed to the table.loadtable action. |
CAS |
The CAS connection object |
data.frame |
The data.frame to upload |
Returns the uncorrected sum of squares of the values for each column in the input table.
cas.uss(CASTable)cas.uss(CASTable)
x |
CASTable. |
This function operates on numeric columns only.
vector
The result is a named numeric vector. You can access the uncorrected sum of squares by column name or index.
## Not run: x <- cas.uss(irisct) x['Sepal.Length'] x[1:2] ## End(Not run)## Not run: x <- cas.uss(irisct) x['Sepal.Length'] x[1:2] ## End(Not run)
Returns the variance of the values for each column in the input table.
cas.var(CASTable)cas.var(CASTable)
x |
CASTable. |
This function operates on numeric columns only.
casDataFrame
The result includes one row for each numeric variable and a column that is named Var for the variance.
## Not run: cas.var(ct[1:4]) cas.var(ct$n2) ## End(Not run)## Not run: cas.var(ct[1:4]) cas.var(ct$n2) ## End(Not run)
This function downloads an in-memory table from the
CAS server and saves it as a CSV file that is accesible
to R (the client). This function is a convenience
wrapper for the R write.csv function.
cas.write.csv( CASTable, file = "", quote = TRUE, eol = "\n", na = "NA", row.names = TRUE, fileEncoding = "" )cas.write.csv( CASTable, file = "", quote = TRUE, eol = "\n", na = "NA", row.names = TRUE, fileEncoding = "" )
CASTable |
The instance of the CASTable to save as as a CSV file. |
file |
An |
quote |
An optional |
eol |
An optional |
na |
An optional |
row.names |
An optional |
fileEncoding |
An optional |
append |
An optional |
sep |
An optional |
dec |
An optional |
col.names |
An optional |
qmethod |
An optional |
This function saves the file on the R client. As an
alternative, you can use the cas.table.save
generated function to save a server-side CSV file.
Other functions for saving in-memory data:
cas.saveRDS(),
cas.write.table(),
cas.write.xlsx()
## Not run: # upload a SAS data set to an in-memory table gold_medals <- cas.read.sas7bdat(s, "/path/to/gold_medals.sas7bdat") # download the in-memory table as a CSV file cas.write.csv(gold_medals, "~/gold_medals.csv") ## End(Not run)## Not run: # upload a SAS data set to an in-memory table gold_medals <- cas.read.sas7bdat(s, "/path/to/gold_medals.sas7bdat") # download the in-memory table as a CSV file cas.write.csv(gold_medals, "~/gold_medals.csv") ## End(Not run)
This function is identical to cas.write.csv
except that it wraps the R write.csv2 function.
The write.csv2 function uses a comma
for the decimal separator and a semicolon for the field
delimiter.
cas.write.csv2( CASTable, file = "", quote = TRUE, eol = "\n", na = "NA", row.names = TRUE, fileEncoding = "" )cas.write.csv2( CASTable, file = "", quote = TRUE, eol = "\n", na = "NA", row.names = TRUE, fileEncoding = "" )
This function downloads an in-memory table from the
CAS server and saves it as a file that is accesible
to R (the client). This function is a convenience
wrapper for the R write.table function.
cas.write.table( CASTable, file = "", append = FALSE, quote = TRUE, sep = " ", eol = "\n", na = "NA", dec = ".", row.names = TRUE, col.names = TRUE, qmethod = c("escape", "double"), fileEncoding = "" )cas.write.table( CASTable, file = "", append = FALSE, quote = TRUE, sep = " ", eol = "\n", na = "NA", dec = ".", row.names = TRUE, col.names = TRUE, qmethod = c("escape", "double"), fileEncoding = "" )
CASTable |
The instance of the CASTable to save as as a file. |
file |
An |
append |
An optional |
quote |
An optional |
sep |
An optional |
eol |
An optional |
na |
An optional |
dec |
An optional |
row.names |
An optional |
col.names |
An optional |
qmethod |
An optional |
fileEncoding |
An optional |
Other functions for saving in-memory data:
cas.saveRDS(),
cas.write.csv(),
cas.write.xlsx()
## Not run: # cas.write.table(myCasTable, file="/path/to/data_out.txt", na="") ## End(Not run)## Not run: # cas.write.table(myCasTable, file="/path/to/data_out.txt", na="") ## End(Not run)
This function downloads an in-memory table from the
CAS server and saves it as an XLSX file that is accesible
to R (the client). This function is a convenience
wrapper for the R write.xslx function.
cas.write.xlsx( CASTable, file = "", sheetName = "Sheet1", col.names = TRUE, row.names = TRUE, append = FALSE, showNA = TRUE )cas.write.xlsx( CASTable, file = "", sheetName = "Sheet1", col.names = TRUE, row.names = TRUE, append = FALSE, showNA = TRUE )
CASTable |
The instance of the CASTable to save as as a CSV file. |
file |
An |
sheetName |
An optional |
col.names |
An optional |
row.names |
An optional |
append |
An optional |
showNA |
An optional |
Other functions for saving in-memory data:
cas.saveRDS(),
cas.write.csv(),
cas.write.table()
## Not run: cas.write.xlsx(myCasTable, file="/path/to/data_out.xlsx") ## End(Not run)## Not run: cas.write.xlsx(myCasTable, file="/path/to/data_out.xlsx") ## End(Not run)
A casDataFrame is a superset of data.frame. The class is used primarily by functions within the package to store tabular data from CAS action results and to associate CAS metadata with the tabular data.
casDataFrame( ..., name = "", label = "", title = "", attrs = list(), col.labels = "", col.formats = "", col.attrs = list(), col.sizes = list(), col.types = "", col.widths = 0 )casDataFrame( ..., name = "", label = "", title = "", attrs = list(), col.labels = "", col.formats = "", col.attrs = list(), col.sizes = list(), col.types = "", col.widths = 0 )
A casDataFrame instance is a data object in R (the client).
casDataFrame
nameAn optional character string that specifies CAS metadata
for a table name.
labelAn optional character string that specifies CAS metadata
for a table label.
titleAn optional character string that specifies CAS metadata
for a table title.
attrsAn optional list of key-value pairs the specify
user-defined CAS metadata.
col.labelsAn optional character string that specifies CAS
metadata for column labels.
col.formatsAn optional character string that specifies CAS
metadata for column formats.
col.attrsAn optional list that specifies CAS metadata for
column attributes.
col.sizesAn optional list that specifies CAS metadata for
the number of bytes in the widest row.
col.typesAn optional character that specifies CAS metadata
for the column data types.
col.widthsAn optional numeric that specifies CAS metadata
for column widths.
dfThe data.frame to encapsulate in the casDataFrame.
casDataFrame
CAS Table Object
CASTable
connA CAS object that represents the connection and
session on the server.
tnameAn optional character string for the table name.
caslibAn optional character string that identifies the caslib for the
in-memory table. Specify this parameter to override the active caslib.
whereAn optional character string that specifies a filter for the
rows to process. The filter uses syntax that is specific to SAS.
orderbyAn optional list of column names. Rows are partitioned according
to the columns in the groupby parameter and then ordered according to
the values of the columns specified in this parameter.
groupbyAn optional list of column names. If you specify this parameter
when you load an in-memory table, then the table is partitioned by the
columns. If you specify this parameter when running an action, then
BY-groups are formed temporarily for the duration of the action.
gbmodeAn optional character string. Values are NOSORT (default) or
REDISTRIBUTE. See the CAS product documentation for more information.
computedOnDemandAn optional logical flag that indicates whether to
the computed variables are created when the table is loaded (False) or to compute
them when an action begins (True).
computedVarsAn optional character string list that identifies the
name and optional information such as a format and label.
computedVarsProgramAn optional character string list. Specify the
expression to use for computing each of the computed variables.
namesAn optional list of column names.
as.casTable, defCasTable
Combine CAS Tables by Columns
## S3 method for class 'casTable' cbind(..., deparse.level = 1)## S3 method for class 'casTable' cbind(..., deparse.level = 1)
This is the implementation of cbind for in-memory tables.
cbind2.casTable(x, y, ...) ## S4 method for signature 'CASTable,ANY' cbind2(x, y, ...)cbind2.casTable(x, y, ...) ## S4 method for signature 'CASTable,ANY' cbind2(x, y, ...)
... |
Arguments that are passed to method arguments. |
deparse.level |
See the help for base::cbind. |
## Not run: cbind(ct1, ct2) cbind(ct1[1:3], ct2$X1) ## End(Not run)## Not run: cbind(ct1, ct2) cbind(ct1[1:3], ct2$X1) ## End(Not run)
Column Means
## S4 method for signature 'CASTable' colMeans(x)## S4 method for signature 'CASTable' colMeans(x)
x |
CASTable. |
vector
cas.mean
## Not run: colMeans(ct[1:4]) colMeans(ct$X1) ## End(Not run)## Not run: colMeans(ct[1:4]) colMeans(ct$X1) ## End(Not run)
Returns the column names from the in-memory table
that is referenced by the CASTable object.
## S4 method for signature 'CASTable' colnames(x)## S4 method for signature 'CASTable' colnames(x)
x |
A CASTable object. |
vector
You cannot use this function to set the column names.
names,CASTable-method
## Not run: colnames(ct1) colnames(ct[1:4]) ## End(Not run)## Not run: colnames(ct1) colnames(ct[1:4]) ## End(Not run)
Column Sums
## S4 method for signature 'CASTable' colSums(x, na.rm = FALSE, dims = 1, ...)## S4 method for signature 'CASTable' colSums(x, na.rm = FALSE, dims = 1, ...)
x |
CASTable. |
vector
cas.sum
## Not run: colSums(ct[1:4]) colSums(ct$X1) ## End(Not run)## Not run: colSums(ct[1:4]) colSums(ct$X1) ## End(Not run)
Unlike the cor function for data frames,
this function does not support specifying the
method as "kendall" or "spearman." The results
for method "pearson" are returned.
## S4 method for signature 'CASTable' cor(x, y = NULL, use = "everything", method = c("pearson"))## S4 method for signature 'CASTable' cor(x, y = NULL, use = "everything", method = c("pearson"))
x |
CASTable. |
matrix
## Not run: cor(ct1) cor(i2[1:4]) cor(i2[c('col1', 'col2', 'col3')]) cor(i2$col1, i2$col2) ## End(Not run)## Not run: cor(ct1) cor(i2[1:4]) cor(i2[c('col1', 'col2', 'col3')]) cor(i2$col1, i2$col2) ## End(Not run)
Unlike the cov function for data frames,
this function does not support specifying the
method as "kendall" or "spearman." The results
for method "pearson" are returned.
## S4 method for signature 'CASTable' cov(x, y = NULL, use = "everything", method = c("pearson"))## S4 method for signature 'CASTable' cov(x, y = NULL, use = "everything", method = c("pearson"))
x |
CASTable. |
matrix
## Not run: cov(ct1) cov(i2[1:4]) cov(i2[c('col1', 'col2', 'col3')]) cov(i2$col1, i2$col2) ## End(Not run)## Not run: cov(ct1) cov(i2[1:4]) cov(i2[c('col1', 'col2', 'col3')]) cov(i2$col1, i2$col2) ## End(Not run)
Creates a CASTable object to reference
an existing in-memory table in CAS. You can use this
function to reference tables that were loaded by other
SAS products, other scripts, or from server-side loads
with the cas.table.loadTable function.
defCasTable( conn, tablename, caslib = "", columns = "", where = "", orderby = list(), groupby = list(), gbmode = "" )defCasTable( conn, tablename, caslib = "", columns = "", where = "", orderby = list(), groupby = list(), gbmode = "" )
conn |
A |
tablename |
A |
caslib |
An optional |
columns |
A |
where |
A |
orderby |
A |
groupby |
A |
gbmode |
A |
## Not run: irisct <- as.casTable(s, iris, casOut="irisct") # Create another CASTable instance to the same in-memory table, # but specify that CAS actions are performed by groups of species. irisct.grouped <- defCasTable(s, tablename="irisct", groupby=list("species")) ## End(Not run)## Not run: irisct <- as.casTable(s, iris, casOut="irisct") # Create another CASTable instance to the same in-memory table, # but specify that CAS actions are performed by groups of species. irisct.grouped <- defCasTable(s, tablename="irisct", groupby=list("species")) ## End(Not run)
Returns the number of rows and columns for the in-memory
table that is referenced by the CASTable object.
## S4 method for signature 'CASTable' dim(x)## S4 method for signature 'CASTable' dim(x)
x |
A CASTable object. |
vector
## Not run: dim(ct1) ## End(Not run)## Not run: dim(ct1) ## End(Not run)
Dimension Names of a CAS Table
## S4 method for signature 'CASTable' dimnames(x)## S4 method for signature 'CASTable' dimnames(x)
x |
A |
list
## Not run: dimnames(ct1) dimnames(ct[2:4]) ## End(Not run)## Not run: dimnames(ct1) dimnames(ct[2:4]) ## End(Not run)
Downloads and extracts platform-specific SWAT (SAS Scripting Wrapper for Analytics Transfer) binary libraries into a swat/ subdirectory of the first library path returned by '.libPaths()'.
download_sas_binaries(libpath = .libPaths())download_sas_binaries(libpath = .libPaths())
libpath |
Character vector of library paths. The first element is used as the installation root. Defaults to '.libPaths()'. |
Invisibly returns the destination path of the extracted 'libs' directory.
## Not run: download_sas_binaries() ## End(Not run)## Not run: download_sas_binaries() ## End(Not run)
Drops the in-memory table on the server that is
referenced by the CASTable object.
dropTable(x)dropTable(x)
x |
A CASTable object. |
This function drops the in-memory table but does not affect the original source file that the in-memory table was loaded from.
## Not run: dropTable(ct1) ## End(Not run)## Not run: dropTable(ct1) ## End(Not run)
Returns the first part of an in-memory table that is referenced
by a CASTable object.
## S4 method for signature 'CASTable' head(x, n = 6L)## S4 method for signature 'CASTable' head(x, n = 6L)
x |
A CASTable object. |
n |
An optional positive integer that specifies the number of rows to return. |
A casDataFrame object with the first n rows.
The head function is not deterministic between reloads of data
or if nodes or added or removed from a distributed server.
## Not run: head(ct1) head(ct[1:4], 10) ## End(Not run)## Not run: head(ct1) head(ct[1:4], 10) ## End(Not run)
Test if an Object is a CAS Table
is.castable(x)is.castable(x)
x |
An |
boolean
## Not run: is.castable(ct1) # TRUE is.castable(iris) # FALSE ## End(Not run)## Not run: is.castable(ct1) # TRUE is.castable(iris) # FALSE ## End(Not run)
Returns the number of columns in an in-memory table
that is referenced by the CASTable object.
## S4 method for signature 'CASTable' length(x)## S4 method for signature 'CASTable' length(x)
x |
A CASTable object. |
scalar
ncol,CASTable-method
## Not run: length(ct1) length(ct[1:4]) ## End(Not run)## Not run: length(ct1) length(ct[1:4]) ## End(Not run)
This function displays the parameters for the specified CAS action.
listActionParms(conn, actn, display = TRUE)listActionParms(conn, actn, display = TRUE)
conn |
An instance of a CAS object that represents a connection and CAS session. |
actn |
A
The third form matches the generated functions for the CAS actions. |
display |
Should the parameters be printed to the screen? |
## Not run: # specify the action set and action name listActionParms(conn, actn="simple.summary") # fetch is in the table action set listActionParms(s, actn="fetch") # specify the generated function name listActionParms(s, cas.regression.logistic) ## End(Not run)## Not run: # specify the action set and action name listActionParms(conn, actn="simple.summary") # fetch is in the table action set listActionParms(s, actn="fetch") # specify the generated function name listActionParms(s, cas.regression.logistic) ## End(Not run)
This function lists all action sets that are installed on the CAS server. The results include a column that is named loaded to indicate if the action set is already available for use or must be loaded before it can be used.
listActionSets(conn)listActionSets(conn)
conn |
An instance of a CAS object that represents a connection and CAS session. |
## Not run: listActionSets(conn) ## End(Not run)## Not run: listActionSets(conn) ## End(Not run)
This function loads a CAS action set and generate an R function for each action.
loadActionSet(conn, actionSet = "")loadActionSet(conn, actionSet = "")
conn |
An instance of a CAS object that represents a connection and CAS session. |
actionSet |
A |
## Not run: loadActionSet(conn, actionSet="decisionTree") loadActionSet(conn, actionSet="regression") ## End(Not run)## Not run: loadActionSet(conn, actionSet="decisionTree") loadActionSet(conn, actionSet="regression") ## End(Not run)
Maximum Values
## S4 method for signature 'CASTable' max(x)## S4 method for signature 'CASTable' max(x)
x |
CASTable. |
scalar
cas.max
## Not run: max(ct1$X1) max(ct1[1:2]) ## End(Not run)## Not run: max(ct1$X1) max(ct1[1:2]) ## End(Not run)
Returns the mean value for the specified column in the input table.
## S4 method for signature 'CASTable' mean(x, ...)## S4 method for signature 'CASTable' mean(x, ...)
x |
CASTable. |
scalar
cas.mean
## Not run: mean(ct1$x1) mean(ct1[2]) ## End(Not run)## Not run: mean(ct1$x1) mean(ct1[2]) ## End(Not run)
Median Values
## S4 method for signature 'CASTable' median(x)## S4 method for signature 'CASTable' median(x)
x |
CASTable. |
scalar
cas.median
## Not run: median(ct1$x1) median(ct1[1:4]) ## End(Not run)## Not run: median(ct1$x1) median(ct1[1:4]) ## End(Not run)
Minimum Value
## S4 method for signature 'CASTable' min(x)## S4 method for signature 'CASTable' min(x)
x |
CASTable. |
scalar
cas.min
## Not run: min(ct1$X1) min(ct1[1:2]) ## End(Not run)## Not run: min(ct1$X1) min(ct1[1:2]) ## End(Not run)
Returns the list of column names for the in-memory
table that is referenced by the CASTable object.
## S4 method for signature 'CASTable' names(x)## S4 method for signature 'CASTable' names(x)
x |
A CASTable object. |
vector
## Not run: names(ct1) ## End(Not run)## Not run: names(ct1) ## End(Not run)
Returns the number of columns in an in-memory table
that is referenced by the CASTable object.
## S4 method for signature 'CASTable' ncol(x)## S4 method for signature 'CASTable' ncol(x)
x |
A CASTable object. |
scalar
length,CASTable-method
## Not run: ncol(ct1) ncol(ct[1:4]) ## End(Not run)## Not run: ncol(ct1) ncol(ct[1:4]) ## End(Not run)
Returns the number of rows in an in-memory table
that is referenced by the CASTable object.
## S4 method for signature 'CASTable' nrow(x)## S4 method for signature 'CASTable' nrow(x)
x |
A CASTable object. |
scalar
## Not run: nrow(ct1) nrow(ct[1:4]) ## End(Not run)## Not run: nrow(ct1) nrow(ct[1:4]) ## End(Not run)
This is the implementation of rbind for in-memory tables.
## S4 method for signature 'CASTable' rbind(..., deparse.level = 1)## S4 method for signature 'CASTable' rbind(..., deparse.level = 1)
... |
Arguments that are passed to method arguments. |
deparse.level |
See the help for base::rbind. |
## Not run: rbind(ct1,ct2) rbind(ct1,ct2, ct3) ## End(Not run)## Not run: rbind(ct1,ct2) rbind(ct1,ct2, ct3) ## End(Not run)
Combine CAS Tables by Columns
rbind.casTable(..., deparse.level = 1)rbind.casTable(..., deparse.level = 1)
This is the implementation of rbind for in-memory tables.
rbind2.casTable(x, y, ...) ## S4 method for signature 'CASTable,ANY' rbind2(x, y, ...)rbind2.casTable(x, y, ...) ## S4 method for signature 'CASTable,ANY' rbind2(x, y, ...)
... |
Arguments that are passed to method arguments. |
deparse.level |
See the help for base::rbind. |
## Not run: rbind(ct1,ct2) rbind(ct1,ct2, ct3) ## End(Not run)## Not run: rbind(ct1,ct2) rbind(ct1,ct2, ct3) ## End(Not run)
Row Names of a CAS Table
## S4 method for signature 'CASTable' rownames(x)## S4 method for signature 'CASTable' rownames(x)
x |
A |
list of strings
## Not run: rownames(ct1) rownames(ct[2:4]) ## End(Not run)## Not run: rownames(ct1) rownames(ct[2:4]) ## End(Not run)
This function enables you to specify a CAS action name and run it. This is an alternative to running an action from the generated function names. An example of a generated function name is cas.table.tableInfo.
runAction(CASorCASTab = "", actn, check_errors = FALSE, ...)runAction(CASorCASTab = "", actn, check_errors = FALSE, ...)
CASorCASTab |
An instance of a CAS object that represents a connection and CAS session, or an instance of a CASTable. |
actn |
A |
... |
Parameters that are passed to the CAS action. |
## Not run: # display the active caslib for the session runAction(conn, "sessionProp.getSessOpt", name="caslib") # display simple summary statistics for an uploaded data frame mtcarsct <- as.casTable(conn, mtcars) runAction(mtcarsct, "simple.summary") # the preceding runAction function is functionally # equivalent to the following generated function cas.simple.summary(mtcarsct) ## End(Not run)## Not run: # display the active caslib for the session runAction(conn, "sessionProp.getSessOpt", name="caslib") # display simple summary statistics for an uploaded data frame mtcarsct <- as.casTable(conn, mtcars) runAction(mtcarsct, "simple.summary") # the preceding runAction function is functionally # equivalent to the following generated function cas.simple.summary(mtcarsct) ## End(Not run)
CAS data frame show method
## S4 method for signature 'casDataFrame' show(object)## S4 method for signature 'casDataFrame' show(object)
object |
A |
data frame listing
Return a subset of rows and columns from a CASTable that meet
subsetting criteria.
subset.casTable(x, subset, select = NULL, drop = FALSE, ...)subset.casTable(x, subset, select = NULL, drop = FALSE, ...)
x |
A CASTable object. |
A CASTable object with the rows and columns that meet the subset criteria.
## Not run: subset(ct, subset = ct[4] > 15, select = c("n1", "n4", "s"), drop = FALSE) subset(ct, subset = ct$n4 > 15, select = c(1, 4, 5), drop = FALSE) ## End(Not run)## Not run: subset(ct, subset = ct[4] > 15, select = c("n1", "n4", "s"), drop = FALSE) subset(ct, subset = ct$n4 > 15, select = c(1, 4, 5), drop = FALSE) ## End(Not run)
Returns simple descriptive statistics.
## S4 method for signature 'CASTable' summary(object, maxsum = 7, digits = max(3, getOption("digits") - 3), ...)## S4 method for signature 'CASTable' summary(object, maxsum = 7, digits = max(3, getOption("digits") - 3), ...)
object |
CASTable. |
table
## Not run: summary(ct1) summary(ct1[1:4]) ## End(Not run)## Not run: summary(ct1) summary(ct1[1:4]) ## End(Not run)
This package enables you to connect from R to a SAS Cloud Analytic Services host, run actions on in-memory tables, and work with the results of the actions.
The CAS class provides an interface to your
connection to the CAS server and CAS session.
The CASTable class provides an interface to the
in-memory tables.
The casDataFrame class provides an interface
to the results for most actions.
Depending on how you install the package, you might be able to use binary communication with CAS. This is more efficient for bandwidth, but requires that your R installation have access to a precompiled library (rswat.so or rswat.dll). An alternative is to communicate with the server using the REST interface of the server over HTTP. See the connection examples that follow.
The responses and results of the actions are returned as R objects.
s <- CAS('cloud.example.com', 5570) # binary communication
s2 <- CAS('cloud.example.com', 8777, protocol='https')
results <- runAction(s, "builtins.serverStatus") results$server nodes actions 1 1 15
You can also run an action using the generated R function:
results <- cas.builtins.serverStatus(s) results$server nodes actions 1 1 15
irisct <- as.casTable(s, iris)
runAction(s, "builtins.loadActionSet", actionSet="regression")
Enter issues at https://github.com/sassoftware/r-swat/issues
See the Actions and Action Sets by Name and Product
Maintainer: Jared Dean [email protected]
Authors:
Tom Weber [email protected]
Kevin Smith [email protected]
Returns the last part of an in-memory table that is referenced
by a CASTable object.
## S4 method for signature 'CASTable' tail(x, n = 6L)## S4 method for signature 'CASTable' tail(x, n = 6L)
x |
A CASTable object. |
A casDataFrame object with the last n rows.
The tail function is not deterministic between reloads of data
or if nodes or added or removed from a distributed server.
## Not run: tail(ct1) tail(ct[1:4], 10) ## End(Not run)## Not run: tail(ct1) tail(ct[1:4], 10) ## End(Not run)
Downloads the in-memory table that is referenced by the CASTable object and stores it as a casDataFrame in R. This function is used primarily by the package to store the results of a CAS action.
to.casDataFrame(ct, obs = 32768)to.casDataFrame(ct, obs = 32768)
ct |
The CASTable object to download. |
Returns a casDataFrame object that contains a copy of the in-memory data.
## Not run: cdf = to.casDataFrame(CASTable) ## End(Not run)## Not run: cdf = to.casDataFrame(CASTable) ## End(Not run)
This function returns the R data.frame object that is encapsulated in a casDataFrame. The CAS metadata is not available in the returned data.frame.
to.data.frame(cdf)to.data.frame(cdf)
cdf |
The casDataFrame to convert |
Data Frame
## Not run: df3 = to.data.frame(cdf) ## End(Not run)## Not run: df3 = to.data.frame(cdf) ## End(Not run)
Downloads the in-memory table that is referenced by the CASTable object and stores it as a data.frame in R. This function is used to download datasets from CAS.
to.r.data.frame(ct, obs = 32768)to.r.data.frame(ct, obs = 32768)
ct |
The CASTable object to download. |
obs |
Number of rows to download, by default 32768 |
Returns a data.frame object that contains a copy of the in-memory data.
## Not run: rdf = to.r.data.frame(CASTable) ## End(Not run)## Not run: rdf = to.r.data.frame(CASTable) ## End(Not run)
Extracts distinct values from columns in a CASTable.
## S4 method for signature 'CASTable' unique(x, incomparables = FALSE, ...)## S4 method for signature 'CASTable' unique(x, incomparables = FALSE, ...)
x |
A CASTable object. |
incomparables |
A vector of values that cannot be compared. See the help for base::unique. |
... |
Arguments that are passed to method arguments. |
A casDataFrame object.
## Not run: unique(ct[4:5]) unique(ct$s) unique(ct[4]) ## End(Not run)## Not run: unique(ct[4:5]) unique(ct$s) unique(ct[4]) ## End(Not run)