haver.mdfields {Haver} | R Documentation

## Set or Query whether Fields ‘alias’ and ‘group’ Are Included in Metadata Queries

### Description

`haver.mdfields` lets you choose whether fields ‘alias’ and ‘group’ should be included in the `HaverMetaData` object returned by a metadata query.

### Usage

    haver.mdfields()
    haver.mdfields(mdfield_alias, mdfield_group)

### Arguments

`mdfield_alias` | a logical `TRUE`/`FALSE`. Indicates whether to include the field ‘alias’ in the metadata query output. If the argument is not supplied, the setting is unchanged.
`mdfield_group` | a logical `TRUE`/`FALSE`. Indicates whether to include the field ‘group’ in the metadata query output. If the argument is not supplied, the setting is unchanged.

### Details

The two metadata fields receive special treatment for the following reasons: The ‘alias’ field is not contained in metadata queries in other Haver software packages, for example, in the Haver package for Python. To make queries directly comparable, one can turn the ‘alias’ field off in R. The ‘group’ field used to be missing from metadata output in Haver package versions 2.4 and lower. This has been remedied in version 3.0.

The defaults upon package load are `TRUE` for ‘alias’ and `FALSE` for ‘group’. These defaults guarantee backwards compatibility to user code written prior to Haver package version 3.0.

Note: You cannot use `haver.setalias` on objects returned by queries run under `mdfield_alias=FALSE`.

### Value

If no arguments are supplied, returns a list with named elements ‘mdfield_alias’ and ‘mdfield_group’ containing logical scalars that indicate the current settings. Otherwise `NULL` is returned.

### See Also

See Haver_package for all help entries related to the Haver package.

### Examples

    haver.path()
    haver.path("examples")

    ## By default, 'alias' is included and 'group' is excluded.
    hmd <- haver.metadata(database='haverd')
    print( hmd , fields.disp=NA )

    ## Requesting a field that has not been retrieved results in an error.
    ## Not run:  print( hmd , fields.disp=c('code', 'start', 'group') )

    ## We change settings and display the results of the same metadata query:
    haver.mdfields()
    haver.mdfields(mdfield_alias=FALSE, mdfield_group=TRUE)
    haver.mdfields()

    hmd <- haver.metadata(database='haverd')
    print( hmd , fields.disp=NA )

    haver.path("restore")

[Package Haver version 3.2 Index]