component: Class providing an object to manipulate a component of a...

Description Usage Arguments Format Value Fields Methods Examples

Description

Class providing an object to manipulate a component of a schedule in a FR Y-9c

Usage

1
2
3

Arguments

num

The line item number of a component of a schedule

name

The name of the line item number

key

The lookup key associated with the line item number

Format

R6Class object.

Value

Object of R6Class

an object of class component

Fields

num

The line item number of a component of a schedule

name

The name of the line item number

key

The lookup key associated with the line item number

dat

A dataset from the Fed with all FR Y-9c data for a quarter. The dataset contains columns with names that correspond to keys

divisor

a numeric that a component's values are divided by

Methods

Documentation
new(num, name, key)

generate a new member of the class

initializeData(dat)

initialize the values in each component

add(comp)

add a sub-component to this component

export_csv()

export this component in CSV format

print()

print the component as a string

getValueFromKey(key)

get a component value from this object or a sub-component that matches the key

getValueFromNum(num)

get a component value from the component number in this object or a sub-component

getCommonSizeValueFromNum(num)

get a component common-sized value from the component number in this object or a sub-component

getCommonSizeValueFromKey(key)

get a component common-sized value from the component key in this object or a sub-component

getValue()

get the value of this object

getCommonSizeValue

get the common-sized value of this object

getKey()

get the key from this object

getNum()

get the num from this object

getName()

get the name from this object

getAllValues()

get the values from this object and all sub-components

getAllNums()

get all the nums from this object and all sub-components

getAllNames()

get all the names from this object and all sub-components

commonSize(divisor)

common-size this component using the divisor

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
x <- Component("1.a.", "Income", "ZZZZ1234")
x$add(Component("1.a.(1)", "Sub-Income", "ABCD5555"))
x$initializeData(data.frame(ZZZZ1234 = 1:4,
                            ABCD5555 = 5:8))
x$export_csv()[1] == "1.a., Income, 1,2,3,4"
print(x)
all(x$getValueFromKey("ABCD5555") == 5:8)
all(x$getValueFromNum("1.a.") == 1:4)
all(x$getValue() == 1:4)
x$getKey() == "ZZZZ1234"
x$getNum() == "1.a."
x$getName() == "Income"
all(unlist(x$getAllValues()) == 1:8)
all(unlist(x$getAllNums()) == c("1.a.", "1.a.(1)"))
all(unlist(x$getAllNames() == c("Income", "Sub-Income")))
x$commonSize(100)
all.equal(x$getCommonSizeValueFromNum("1.a."), (1:4)/100)
all.equal(x$getCommonSizeValueFromKey("ZZZZ1234"), (1:4)/100)
all.equal(x$getCommonSizeValue(), (1:4)/100)

bertcarnell/fry9c documentation built on May 13, 2019, 5:22 p.m.