haver.codelists {Haver} | R Documentation

## Extract Lists of Haver Series Codes

### Description

`haver.codelists` extracts lists of Haver series codes from Haver objects of type `HaverMetaData`, `HaverData`, and `HaverErrorReport`.

### Usage

    haver.codelists(x)

### Arguments

`x` | an object of type `HaverMetaData`, `HaverData`, or `HaverErrorReport`

### Details

The objects of the Haver package contain information on various Haver series code lists. For the most part, this information is related to the section ‘When Data Cannot Be Retrieved’ of `haver.data`. `haver.codelists` accesses this information.

### Value

`haver.codelists` always returns a list whose elements are character vectors, possibly of length zero. In turn, the elements of the character vectors are Haver codes in database:seriescode format. The returned lists have the following named elements:

argument type | element name | vector contents
`HaverMetaData` | codes.out | series that hold records in the object
`HaverData` | noobs | series that do not have any valid data points
| noagg | series that cannot be aggregated
| nodisagg | series that cannot be disaggregated
| codes.out | series whose data has been retrieved
`HaverErrorReport` | codes.found | series whose code and database were found
| database.access | series whose database could not be accessed.
|  | The most likely reason for this is that the
|  | database name is misspelled or that
|  | `haver.path` is set incorrectly.
| codes.notfound | series whose series code was not found
| metadata.access | series whose metadata could not be accessed

### See Also

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

### Examples

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

    ## When applying the function to a 'HaverMetaData' object, a list
    ## of codes that have records in the object is returned
    hmd_w <- haver.metadata(dat="haverw")
    haver.codelists(hmd_w)

    ## Applying the function to 'HaverData' objects yields information on
    ## the successfully retrieved series and on the ones that got dropped:
    hmd_mqa <- haver.metadata(dat="havermqa")
    hd_q    <- haver.data(codes=hmd_mqa, freq="quarterly")
    haver.codelists(hd_q)

    ## Lastly, one can apply 'haver.codelists' to 'HaverErrorReport' objects.
    ## The latter are returned by 'haver.data' and 'haver.metadata'
    ## when there is a fundamental flaw in a query.
    ex_codes <- c("wrongdb:code1", "wrongdb:code2", "haverd:wrongcode")
    her_hd  <- haver.data(ex_codes)
    her_hd
    haver.codelists(her_hd)

    ## The same object is returned from a correspondingly flawed metadata query:
    her_hmd <- haver.metadata(ex_codes)
    her_hmd
    haver.codelists(her_hmd)

    haver.path("restore")

[Package Haver version 3.2 Index]