aggregate
関数を使用して、データをまとめることができます。
例3-6 データの集計
この例では、iris
データセットをデータベース・メモリーにore.frame
オブジェクトのiris_of
としてプッシュします。length
関数を使用して、iris_of
の値をSpecies列で集計します。その後、結果の最初の3行を表示します。
# 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)この例のリスト
# 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
関連項目:
aggregate
のスクリプト例