Skip to content

Instantly share code, notes, and snippets.

@iangow
Last active February 1, 2026 16:46
Show Gist options
  • Select an option

  • Save iangow/809e67527c41dd54872f155b67f6c442 to your computer and use it in GitHub Desktop.

Select an option

Save iangow/809e67527c41dd54872f155b67f6c442 to your computer and use it in GitHub Desktop.
Code showing that WRDS Call Report data has same issue
library(dplyr, warn.conflicts = FALSE)
library(tidyr)
library(wrds)
#> ── Checking WRDS credentials ───────────────────────────────────── wrds 0.0.1 ──
#> ✔ Credentials found for user iangow
library(farr, warn.conflicts = FALSE)

db <- wrds_connect()

wrds_call_te_1 <- tbl(db, I("bank.wrds_call_te_1"))

wrds_call_te_1 |>
  filter(rssd9001 == 490937, 
                wrdsreportdate == "2004-06-30") |> 
  select(rssd9001, starts_with("text")) |>
  pivot_longer(!rssd9001) |>
  filter(!is.na(value)) |>
  collect() |>
  system_time()
#>    user  system elapsed 
#>   1.156   0.031   4.081
#> # A tibble: 6 × 3
#>   rssd9001 name     value                                                   
#>      <int> <chr>    <chr>                                                   
#> 1   490937 text4469 ns Exp, Bus Dev, P                                      
#> 2   490937 text4468 Courier, Audit Tax, Deff Comp, Other                    
#> 3   490937 text3549 IENC SECURITIES                                         
#> 4   490937 text3550 IENC CD'S                                               
#> 5   490937 text4464 ATM Fees, Exam Fees, Dues & Chairitable Cont            
#> 6   490937 text4467 Telephone, BanClub, Federal Res Fees, NSF and Other Loss

Created on 2026-02-01 with reprex v2.1.1

@iangow
Copy link
Author

iangow commented Feb 1, 2026

Below we see that the WRDS data are incorrect for the second case.

library(dplyr, warn.conflicts = FALSE)
library(tidyr)
library(wrds)
#> ── Checking WRDS credentials ───────────────────────────────────── wrds 0.0.1 ──
#> ✔ Credentials found for user iangow
library(farr, warn.conflicts = FALSE)

db <- wrds_connect()

wrds_call_te_1 <- tbl(db, I("bank.wrds_call_te_1"))

bad_rows <-
  wrds_call_te_1 |>
  filter(rssd9001 %in% c(47500, 345756), 
         wrdsreportdate == "2022-12-31") |> 
  select(rssd9001, text6980) |>
  pivot_longer(!rssd9001) |>
  filter(!is.na(value)) |>
  collect() |>
  system_time()
#>    user  system elapsed 
#>   0.028   0.001   0.146
  
bad_rows$value[1]
#> [1] "We have made 3 corrections in this amendment.1 - We have added a late tax entry DR Current Taxes, CR Deferred Taxes, CR Tax Expense booked after we submitted.2 - We discovered we were incorrectly allocating our Brokered Deposits as over $250,000 vs under $250,000, as the underlying deposits are sold in $1,000 increments.3 - We discovered we were incorrectly allocating our Reciprocal Money Market Sweep accounts as over $250,000 vs under $250,000"
bad_rows$value[2]
#> [1] "Edit Name:"

Created on 2026-02-01 with reprex v2.1.1

@iangow
Copy link
Author

iangow commented Feb 1, 2026

Related issue is here: iangow/ffiec.pq#3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment