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

componentR Documentation

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

Description

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

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

Usage

Component(num, name, key)

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

Value

an object of class component

Methods

Public methods


Method new()

initialize the values in each component

Usage
.component$new(num, name, key)
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


Method initializeData()

initialize object with data

Usage
.component$initializeData(dat)
Arguments
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


Method add()

add a sub-component to this component

Usage
.component$add(comp)
Arguments
comp

a component


Method export_csv()

export this component in CSV format

Usage
.component$export_csv()

Method print()

print the component as a string

Usage
.component$print()

Method getMetricFrom()

get a metric

Usage
.component$getMetricFrom(key, num = NA, metric = .metric$value)
Arguments
key

The lookup key associated with the line item number

num

The line item number of a component of a schedule

metric

the metric name


Method getValueFromKey()

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

Usage
.component$getValueFromKey(key)
Arguments
key

The lookup key associated with the line item number


Method getValueFromNum()

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

Usage
.component$getValueFromNum(num)
Arguments
num

The line item number of a component of a schedule


Method getNumFromKey()

Get a num from a key

Usage
.component$getNumFromKey(key)
Arguments
key

The lookup key associated with the line item number


Method getKeyFromNum()

get a key from a num

Usage
.component$getKeyFromNum(num)
Arguments
num

The line item number of a component of a schedule


Method getCommonSizeValueFromNum()

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

Usage
.component$getCommonSizeValueFromNum(num)
Arguments
num

The line item number of a component of a schedule


Method getCommonSizeValueFromKey()

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

Usage
.component$getCommonSizeValueFromKey(key)
Arguments
key

The lookup key associated with the line item number


Method getComponentFrom()

get a Component

Usage
.component$getComponentFrom(key, num = NA)
Arguments
key

The lookup key associated with the line item number

num

The line item number of a component of a schedule


Method getComponentFromKey()

Get a component from a key

Usage
.component$getComponentFromKey(key)
Arguments
key

The lookup key associated with the line item number


Method getComponentFromNum()

Get a component from a key

Usage
.component$getComponentFromNum(num)
Arguments
num

The line item number of a component of a schedule


Method getValue()

get the value of this object

Usage
.component$getValue()

Method getCommonSizeValue()

get the common-sized value of this object

Usage
.component$getCommonSizeValue()

Method getKey()

get the key from this object

Usage
.component$getKey()

Method getNum()

get the num from this object

Usage
.component$getNum()

Method getName()

get the name from this object

Usage
.component$getName()

Method getAllValues()

get the values from this object and all sub-components

Usage
.component$getAllValues()

Method getAllNums()

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

Usage
.component$getAllNums()

Method getAllNames()

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

Usage
.component$getAllNames()

Method commonSize()

common-size this component using the divisor

Usage
.component$commonSize(divisor)
Arguments
divisor

a numeric that a component's values are divided by


Method clone()

The objects of this class are cloneable with this method.

Usage
.component$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

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 April 18, 2022, 10:05 p.m.