Learn R Programming

dfidx (version 0.1-0)

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)

Value

a data.frame for the unfold_dfidx function, a dfidx

object for the fold_dfidx function

Arguments

x

a dfidx object

pkg

if not NULL, this argument is passed to dfidx

Author

Yves Croissant

Examples

Run this code
mn <- dfidx(munnell, idx = c(region = "state", "year"), position = 3, name = "index")
mn2 <- unfold_idx(mn)
attr(mn, "ids")
mn3 <- fold_idx(mn2)
identical(mn, mn3)

Run the code above in your browser using DataLab