Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

unfold_idx

Fold and Unfold a dfidx object


Description

fold_idx takes a dfidx, includes the indexes as stand alone columns, remove the idx column and return a data.frame, with an ids attribute that contains the informations about the indexes. fold_idx performs the opposite operation

Usage

unfold_idx(x)

fold_idx(x, pkg = NULL)

Arguments

x

a dfidx object

pkg

if not NULL, this argument is passed to dfidx

Value

a data.frame for the unfold_dfidx function, a dfidx object for the fold_dfidx function

Author(s)

Yves Croissant

Examples

data("TravelMode", package = "AER")
TM <- dfidx(TravelMode)
TM2 <- unfold_idx(TM)
attr(TM2, "ids")
TM3 <- fold_idx(TM2)
identical(TM, TM3)

dfidx

Indexed Data Frames

v0.0-4
GPL (>= 2)
Authors
Yves Croissant [aut, cre]
Initial release
2021-02-02

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.