3.1.5 Summarize Data
Summarize data with the aggregate
function.
Example 3-6 Aggregating Data
This example pushes the iris
data set to database memory as the ore.frame
object iris_of
. It aggregates the values of iris_of
by the Species column using the length
function. It then displays the first three rows of the result.
# Create a temporary database table from the iris data set and get an ore.frame. iris_of <- ore.push(iris) aggdata <- aggregate(iris_of$Sepal.Length, by = list(species = iris_of$Species), FUN = length) head(aggdata, 3)Listing for This Example
# Create a temporary database table from the iris data set and get an ore.frame.
R> iris_of <- ore.push(iris)
R> aggdata <- aggregate(iris_of$Sepal.Length,
+ by = list(species = iris_of$Species),
+ FUN = length)
R> head(aggdata, 3)
species x
setosa setosa 50
versicolor versicolor 50
virginica virginica 50