Learn R Programming

RCassandra (version 0.1-3)

RC.read.table: Read and write tables into column families in Cassandra

Description

RC.read.table reads the contents of a column family into a data frame

RC.write.table writes the contents of a data frame into a column familly

Usage

RC.read.table(conn, c.family, convert = TRUE, na.strings = "NA", as.is = FALSE, dec = ".") RC.write.table(conn, c.family, df)

Arguments

conn
connection handle as obtained form RC.connect
c.family
column family name (string)
convert
logical, if TRUE the resulting data frame is processed using type.convert, otherwise all columns will be character vectors
na.strings
passed to type.convert
as.is
passed to type.convert
dec
passed to type.convert
df
data frame - it must have both row and column names

Value

RC.read.table returns the resulting data frameRC.write.table returns conn

Details

Cassandra is a key/value store with dynamic columns, so tables are not the native format. Row names are used as keys and columns are treated as fixed. RC.read.table is really jsut a wrapper for RC.get.range.slices(conn, c.family, fixed=TRUE). RC.write.table uses the same facility as RC.mutate but without actually creating the mutation object on the R side.

Note that all updates in Cassandra are "upserts", i.e., RC.write.table updates any existing row key/coumn name combinations or creates new ones where not present (insert). Additonal columns (or even keys) may still exist in the column family and they will not be touched.

RC.read.table creates a data frame from all columns that are ever encountered in at least one key. All other values are filled with NAs.

See Also

RC.connect, RC.use, RC.get