monet.frame
wraps a MonetDB table or query result and behaves like a R data.frame
.monet.frame( conn, tableOrQuery, debug=FALSE )
monet.frame
virtual data object that behaves similar to a data.frame
.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.
mf
-- Shorthand constructor, also creates a DB connectionas.data.frame
-- DB table or query result to Rdata.frame
objectas.vector
-- Single DB column to Rvector
str
-- Display object structure (SQL query, columns, data types, ..)print
-- Prints database content wrapped in object to screen)summary
-- Calculates summaries on wrapped database content)names
-- Gets the column names of the wrapped query result or table as vectordim
-- Gets the dimension (#rows/#cols) of the wrapped query result or tablelength
-- Gets the number of columns of the wrapped query result or tablena.fail
-- Raise an error if any value is NA/NULL (only for single columns)head
-- Gets the first n rows from the wrapped query result or table asdata.frame
tail
-- Gets the last n rows from the wrapped query result or table asdata.frame
[
-- Extracts specific rows and columns from the wrapped object, behaves like[
ondata.frame
$
-- Extracts a single column from the wrapped object, behaves like$
ondata.frame
subset
-- Returns a subset of the wrapped table that meets filter conditionsna.omit
-- Filters out NA/NULL values (only for single columns)sample
-- Gets n randomly selected rows of the wrapped query result or table asdata.frame
abs
,sign
,sqrt
,floor
,ceiling
,trunc
,round
,signif
exp
,log
,expm1
,log1p
,cos
,sin
,tan
,acos
,asin
,atan
,cosh
,sinh
,tanh
,acosh
,asinh
,atanh
"+"
,"-"
,"*"
,"/"
,"^"
,"%%"
,"%/%"
"&"
,"|"
,"!"
"=="
,"!="
,"<"< code="">,"<="< code="">,">="
,">"
="<>
"<>
min
,max
,sum
,range
,prod
sd
-- Calculates the standard deviation (only for single columns)
var
-- Calculates the variance (only for single columns)
quantile
-- Provides quantile values (only for single numeric columns)
median
-- Retrieves the Median value (only for single numeric columns)
aggregate
-- Computes summary statistics by groups
aggregatef
-- Computes summary statistics by groups using formula
rbind
-- Combines monet.frame
objects of compatible structure through concatenation
merge
-- Merge two monet.frame
objects together using a DB JOIN operation
sort
-- Sort a database column ascending or descending (only for single columns)
tabulate
-- Counts the number of value occurences (only for single numerical columns)
range
-- Gives range of values (only for single numerical columns)data.frame