Reads ZTRAX flat files in chunks, optionally filters rows, and loads into the
data into a SQL database. Refer to ztrax_layout for details of each table.
db_write_table_ztrax(.con, data_dir, states, ZType = c("ZTrans", "ZAsmt"), TableName, KeepColumns = NULL, FilterColumns = NULL, .filter = NULL, chunk_size = 10000, overwrite = FALSE)
| .con | A DBIConnection object, as returned by   | 
    
|---|---|
| data_dir | A path to a single directory containing uncompressed folders  | 
    
| states | The name, 2-letter abbreviation, or FIPS code for one or more states.  | 
    
| ZType | Either   | 
    
| TableName | Name of table to be added to the database, as it appears in
documentation and raw data file names (  | 
    
| KeepColumns | A vector of names of columns to be included in table on
the database, as they appear in documentation (  | 
    
| FilterColumns | A vector of names of any columns not already included in
  | 
    
| .filter | A function, formula to be passed to   | 
    
| chunk_size | The number of rows to include in each chunk.  | 
    
| overwrite | If   | 
    
library(DBI) library(dplyr)#> #>#> #> #>#> #> #>con <- dbConnect(RSQLite::SQLite(), ":memory:") db_write_table_ztrax( .con = con, data_dir = ztrax_example_dir(), states = c("FL", "NY"), ZType = "ZAsmt", TableName = "TaxExemption", KeepColumns = c("RowID", "TaxExemptionStndCode"), FilterColumns = "FIPS", .filter = ~ filter(., FIPS %in% c("12086", "36005")), chunk_size = 2, overwrite = FALSE )#>#> #> #> #> #>#>#>#> # Source: table<zasmt_tax_exemption> [?? x 2] #> # Database: sqlite 3.22.0 [:memory:] #> row_id tax_exemption_stnd_code #> <chr> <chr> #> 1 1A284B67-3182-E711-80C2-3863BB43E814 HD #> 2 1E284B67-3182-E711-80C2-3863BB43E814 HD #> 3 1E284B67-3182-E711-80C2-3863BB43E814 SC #> 4 1E284B67-3182-E711-80C2-3863BB43E814 WW #> 5 1D389B67-3182-E711-80C2-3863BB43E813 WW #> 6 1D389B67-3182-E711-80C2-3863BB43E813 HD