dplyr: Methods for dplyr verbs

dplyrR Documentation

Methods for dplyr verbs

Description

methods of dplyr verbs for dfidx objects. Default functions don't work because most of these functions returns either a tibble or a data.frame but not a dfidx

Usage

## S3 method for class 'dfidx'
arrange(.data, ...)

## S3 method for class 'dfidx'
filter(.data, ...)

## S3 method for class 'dfidx'
slice(.data, ...)

## S3 method for class 'dfidx'
mutate(.data, ...)

## S3 method for class 'dfidx'
transmute(.data, ...)

## S3 method for class 'dfidx'
select(.data, ...)

Arguments

.data

a dfidx object,

...

further arguments

Details

These methods always return the data frame column that contains the indexes and return a dfidx object.

Value

an object of class "dfidx"

Author(s)

Yves Croissant

Examples

if (requireNamespace("AER")){
data("TravelMode", package = "AER")
TM <- dfidx(TravelMode)
select(TM, - wait, - vcost)
mutate(TM, inc2  = income ^ 2, linc = log(income))
transmute(TM, inc2  = income ^ 2, linc = log(income))
arrange(TM, desc(size), income)
filter(TM, income > 35, size <= 2)
pull(TM, income)
slice(TM, c(1:2, 5:7))
}

dfidx documentation built on June 28, 2022, 5:06 p.m.