monet.frame: Virtual R data object for MonetDB tables and query results

Description Usage Arguments Details Value See Also Examples

Description

monet.frame wraps a MonetDB table or query result and behaves like a R data.frame.

Usage

1
  monet.frame( conn, tableOrQuery, debug=FALSE )

Arguments

conn

A MonetDB.R database connection. Created using dbConnect with the MonetDB.R database driver.

tableOrQuery

A string either naming a database table or a SQL query as a basis for the new object.

debug

Logical value indicating whether the SQL queries being rewritten in the background are printed or not.

Details

monet.frame wraps a MonetDB table or query result and behaves like a R data.frame. Many operations typical for data.frame are supported, e.g. $, [, basic math and comparisons.

Data is only loaded when as.data.frame or as.vector are called, and most basic operations and calculations are mapped to SQL statements. This greatly reduces the amount of data that has to be transferred between MonetDB and R and thereby also increases speed, allowing you to analyse even more data with R.

So far, the following user-facing R functions are implemented by monet.frame objects. The signatures and semantics of these methods closely follow those implemented for data.frame objects.

Value

Returns a monet.frame virtual data object that behaves similar to a data.frame.

See Also

data.frame

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
# connect to MonetDB
conn <- dbConnect(MonetDB.R(), "monetdb://localhost/demo")
# write some test data
data(iris)
dbWriteTable(conn, "iris", iris)
# construct monet.frame
frame <- monet.frame(conn,"iris")
# show description
str(frame)
# select one of the colums
frame$sepal_width
# select ten rows and the first two columns
frame[1:10,1:2]
# calculate aggregation
mean(frame$sepal_width)

## End(Not run)

MonetDB.R documentation built on May 2, 2019, 5:26 p.m.