Learn R Programming

mets (version 1.2)

daggregate: aggregating for for data frames

Description

aggregating for for data frames

Usage

daggregate(data, y = NULL, x = NULL, subset, ..., fun = "summary",
  regex = mets.options()$regex, missing = FALSE, remove.empty = FALSE,
  matrix = FALSE, silent = FALSE, na.action = na.pass)

Arguments

data
data.frame
y
name of variable, or formula, or names of variables on data frame.
x
name of variable, or formula, or names of variables on data frame.
subset
subset expression
...
additional arguments to lower level functions
fun
function defining aggregation
regex
interpret x,y as regular expressions
missing
Missing used in groups (x)
remove.empty
remove empty groups from output
matrix
if TRUE a matrix is returned instead of an array
silent
suppress messages
na.action
How model.frame deals with 'NA's

Examples

Run this code
data("sTRACE",package="timereg")
daggregate(iris, "^.e.al", x="Species", fun=cor, regex=TRUE)
daggregate(iris, Sepal.Length+Petal.Length ~Species, fun=summary)
daggregate(iris, log(Sepal.Length)+I(Petal.Length>1.5) ~ Species,
                 fun=summary)
daggregate(iris, "*Length*", x="Species", fun=head)
daggregate(iris, "^.e.al", x="Species", fun=tail, regex=TRUE)
daggregate(sTRACE, status~ diabetes, fun=table)
daggregate(sTRACE, status~ diabetes+sex, fun=table)
daggregate(sTRACE, status + diabetes+sex ~ vf+I(wmi>1.4), fun=table)
daggregate(iris, "^.e.al", x="Species",regex=TRUE)
dlist(iris,Petal.Length+Sepal.Length ~ Species |Petal.Length>1.3 & Sepal.Length>5,
            n=list(1:3,-(3:1)))
daggregate(iris, I(Sepal.Length>7)~Species | I(Petal.Length>1.5))
daggregate(iris, I(Sepal.Length>7)~Species | I(Petal.Length>1.5),
                 fun=table)

dsum(iris, .~Species, matrix=TRUE, missing=TRUE)

Run the code above in your browser using DataLab