methods.dfidx: Methods for dfidx

methods.dfidxR Documentation

Methods for dfidx

Description

A dfidx is a data.frame with a "sticky" data.frame column which contains the indexes. Specific methods of functions that extract lines and/or columns of a data.frame are provided.

Usage

## S3 method for class 'tbl_dfidx'
print(x, ..., n = NULL)

## S3 method for class 'vecidx'
vec_ptype_abbr(x, ..., prefix_named, suffix_shape)

## S3 method for class 'vecidx'
format(x, ...)

## S3 method for class 'vecidx'
pillar_shaft(x, ...)

## S3 method for class 'tbl_dfidx2'
tbl_sum(x, ...)

Arguments

x

a dfidx object

...

further arguments

n

the number of rows for the print method

prefix_named, suffix_shape

see vctrs::vec_ptype_abbr

Value

as.data.frame and mean return a data.frame, [[ and $ a vector, [ either a dfidx or a vector, ⁠$<-⁠ and ⁠[[<-⁠ modify the values of an existing column or create a new column of a dfidx object, print is called for its side effect

Author(s)

Yves Croissant

Examples

data("munnell", package = "dfidx")
mn <- dfidx(munnell)
# extract a series (returns as a xseries object)
mn$gsp
# or
mn[["gsp"]]
# extract a subset of series (returns as a dfidx object)
mn[c("gsp", "unemp")]
# extract a subset of rows and columns
mn[mn$unemp > 10, c("utilities", "water")]
# dfidx, idx and xseries have print methods as (like tibbles), a n
# argument
print(mn, n = 3)
print(idx(mn), n = 3)
print(mn$gsp, n = 3)
# a dfidx object can be coerced to a data.frame
head(as.data.frame(mn))

tidydfidx documentation built on June 16, 2025, 5:08 p.m.