Last chance! 50% off unlimited learning
Sale ends in
This function extract the names of the indexes or the name of a specific index
idx_name(x, n = 1, m = NULL)# S3 method for dfidx
idx_name(x, n = NULL, m = NULL)
# S3 method for idx
idx_name(x, n = NULL, m = NULL)
# S3 method for xseries
idx_name(x, n = NULL, m = NULL)
if n
is NULL
, a named integer which gives the posititon
of the idx
column in the dfidx
object, otherwise, a
character of length 1
a dfidx
, a idx
or a xseries
object
the index to be extracted (1 or 2, ignoring the nesting variables)
if > 1, a nesting variable
Yves Croissant
mn <- dfidx(munnell, idx = c(region = "state", president = "year"))
# get the position of the idx column
idx_name(mn)
# get the name of the first index
idx_name(mn, 1)
# get the name of the second index
idx_name(mn, 2)
# get the name of the nesting variable for the second index
idx_name(mn, 2, 2)
Run the code above in your browser using DataLab