component | R Documentation |
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
Component(num, name, key)
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 |
an object of class component
new()
initialize the values in each component
.component$new(num, name, key)
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
initializeData()
initialize object with data
.component$initializeData(dat)
dat
A dataset from the Fed with all FR Y-9c data for a quarter. The dataset contains columns with names that correspond to key
s
add()
add a sub-component
to this component
.component$add(comp)
comp
a component
export_csv()
export this component
in CSV format
.component$export_csv()
print()
print the component
as a string
.component$print()
getMetricFrom()
get a metric
.component$getMetricFrom(key, num = NA, metric = .metric$value)
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
getValueFromKey()
get a component
value from this object or a sub-component
that matches the key
.component$getValueFromKey(key)
key
The lookup key associated with the line item number
getValueFromNum()
get a component
value from the component
number in this object or a sub-component
.component$getValueFromNum(num)
num
The line item number of a component of a schedule
getNumFromKey()
Get a num from a key
.component$getNumFromKey(key)
key
The lookup key associated with the line item number
getKeyFromNum()
get a key from a num
.component$getKeyFromNum(num)
num
The line item number of a component of a schedule
getCommonSizeValueFromNum()
get a component
common-sized value from the component
number in this object or a sub-component
.component$getCommonSizeValueFromNum(num)
num
The line item number of a component of a schedule
getCommonSizeValueFromKey()
get a component
common-sized value from the component
key
in this object or a sub-component
.component$getCommonSizeValueFromKey(key)
key
The lookup key associated with the line item number
getComponentFrom()
get a Component
.component$getComponentFrom(key, num = NA)
key
The lookup key associated with the line item number
num
The line item number of a component of a schedule
getComponentFromKey()
Get a component from a key
.component$getComponentFromKey(key)
key
The lookup key associated with the line item number
getComponentFromNum()
Get a component from a key
.component$getComponentFromNum(num)
num
The line item number of a component of a schedule
getValue()
get the value of this object
.component$getValue()
getCommonSizeValue()
get the common-sized value of this object
.component$getCommonSizeValue()
getKey()
get the key
from this object
.component$getKey()
getNum()
get the num
from this object
.component$getNum()
getName()
get the name
from this object
.component$getName()
getAllValues()
get the values from this object and all sub-component
s
.component$getAllValues()
getAllNums()
get all the num
s from this object and all sub-component
s
.component$getAllNums()
getAllNames()
get all the name
s from this object and all sub-component
s
.component$getAllNames()
commonSize()
common-size this component using the divisor
.component$commonSize(divisor)
divisor
a numeric that a component
's values are divided by
clone()
The objects of this class are cloneable with this method.
.component$clone(deep = FALSE)
deep
Whether to make a deep clone.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.