dplyr (version 0.2)

manip_dt: Data manipulation for data tables.

Description

Data manipulation for data tables.

Usage

# S3 method for data.table
filter(.data, ..., .env = parent.frame())

# S3 method for data.table summarise(.data, ...)

# S3 method for data.table mutate(.data, ..., inplace = FALSE)

# S3 method for data.table arrange(.data, ...)

# S3 method for data.table select(.data, ...)

Arguments

.data
a data table
...
variables interpreted in the context of .data
inplace
if FALSE (the default) the data frame will be copied prior to modification to avoid changes propagating via reference.
.env
The environment in which to evaluate arguments not included in the data. The default should suffice for ordinary usage.

Examples

Run this code
if (require("data.table")) {
# If you start with a data table, you end up with a data table
data("hflights", package = "hflights")
hflights <- as.data.table(hflights)
filter(hflights, Month == 1, DayofMonth == 1, Dest == "DFW")
head(select(hflights, Year:DayOfWeek))
summarise(hflights, delay = mean(ArrDelay, na.rm = TRUE), n = length(ArrDelay))
head(mutate(hflights, gained = ArrDelay - DepDelay))
head(arrange(hflights, Dest, desc(ArrDelay)))

# If you start with a tbl, you end up with a tbl
hflights2 <- as.tbl(hflights)
filter(hflights2, Month == 1, DayofMonth == 1, Dest == "DFW")
head(select(hflights2, Year:DayOfWeek))
summarise(hflights2, delay = mean(ArrDelay, na.rm = TRUE), n = length(ArrDelay))
head(mutate(hflights2, gained = ArrDelay - DepDelay))
head(arrange(hflights2, Dest, desc(ArrDelay)))
}

Run the code above in your browser using DataCamp Workspace