schedule: Class providing an object to manipulate a schedule in a FR...

scheduleR Documentation

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

Description

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

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

Usage

Schedule(desig, title)

Arguments

desig

the designator of the schedule, e.g. "HI"

title

the title of the schedule

Value

an object of class schedule

Methods

Public methods


Method new()

Initialize an object

Usage
.schedule$new(desig, title)
Arguments
desig

the designator of the schedule, e.g. "HI"

title

the title of the schedule


Method initializeData()

initialize the values in each schedule

Usage
.schedule$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 component to this schedule

Usage
.schedule$add(comp)
Arguments
comp

a component


Method export_csv()

export this schedule in CSV format

Usage
.schedule$export_csv()

Method print()

print the schedule as a string

Usage
.schedule$print()

Method getMetricFrom()

Get metric from key or num

Usage
.schedule$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


Method getComponentFrom()

get component from key and num

Usage
.schedule$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 getValueFromKey()

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

Usage
.schedule$getValueFromKey(key)
Arguments
key

The lookup key associated with the line item number


Method getNumFromKey()

get num from key

Usage
.schedule$getNumFromKey(key)
Arguments
key

The lookup key associated with the line item number


Method getKeyFromNum()

get key from num

Usage
.schedule$getKeyFromNum(num)
Arguments
num

The line item number of a component of a schedule


Method getValueFromNum()

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

Usage
.schedule$getValueFromNum(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
.schedule$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
.schedule$getCommonSizeValueFromKey(key)
Arguments
key

The lookup key associated with the line item number


Method getComponentFromKey()

get component from key

Usage
.schedule$getComponentFromKey(key)
Arguments
key

The lookup key associated with the line item number


Method sumLevels()

add or subtract the components in this schedule

Usage
.schedule$sumLevels(pos_num_list, neg_num_list)
Arguments
pos_num_list

a vector of component nums to be added

neg_num_list

a vector of component nums to be subtracted


Method getDesig()

get the desig for this object

Usage
.schedule$getDesig()

Method getTitle()

get the title for this object

Usage
.schedule$getTitle()

Method getBankNames()

get the bank_names assigned to this object

Usage
.schedule$getBankNames()

Method addBankNames()

add bank_names to this object

Usage
.schedule$addBankNames(bank_names)
Arguments
bank_names

a vector of bank names to be stored in the schedule


Method createDataFrame()

create a data.frame from the components in this object

Usage
.schedule$createDataFrame()

Method getComponent()

get a component by its index in the schedule

Usage
.schedule$getComponent(index)
Arguments
index

the index of the component


Method commonSize()

common-size the components in this schedule using the divisor

Usage
.schedule$commonSize(divisor)
Arguments
divisor

common size divisor


Method clone()

The objects of this class are cloneable with this method.

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

Whether to make a deep clone.

Examples

x <- Schedule("HI", "Income Statement")
y <- Component("1.a.", "Income", "ZZZZ1234")
y$add(Component("1.a.(1)", "Sub-Income", "ABCD5555"))
x$add(y)
x$initializeData(data.frame(ZZZZ1234 = 1:4,
                            ABCD5555 = 5:8))
x$addBankNames(paste("bank", LETTERS[1:4], sep=""))
all(x$export_csv() == c("Schedule HI, Income Statement, ",
                        "1.a., Income, 1,2,3,4",
                        "1.a.(1), Sub-Income, 5,6,7,8"))
print(x)
all(x$getValueFromKey("ABCD5555") == 5:8)
all(x$getValueFromNum("1.a.") == 1:4)
x$getDesig() == "HI"
x$getTitle() == "Income Statement"
all(x$getBankNames() == paste("bank", LETTERS[1:4], sep=""))
x$getComponent(1)$getKey() == "ZZZZ1234"
all(x$sumLevels(c("1.a.", "1.a.(1)"), NA) == 1:4 + 5:8)
all(x$sumLevels("1.a.", "1.a.(1)") == 1:4 - 5:8)
all(x$createDataFrame()$bankA == c(1,5))
x$commonSize(100)
all.equal(x$getCommonSizeValueFromNum("1.a."), (1:4)/100)
all.equal(x$getCommonSizeValueFromKey("ZZZZ1234"), (1:4)/100)

bertcarnell/fry9c documentation built on April 18, 2022, 10:05 p.m.