Nason commited on
Commit
b232134
·
verified ·
1 Parent(s): 6f70fbc

Add tested R query how-to and correct usage examples

Browse files
Files changed (1) hide show
  1. README.md +20 -7
README.md CHANGED
@@ -25,11 +25,7 @@ A clean, queryable DuckDB database built from ICE enforcement data published by
25
 
26
  **23,568,538 rows** across **6 tables** covering ICE arrests, detainers, detentions, removals, and custody decisions.
27
 
28
- Combines two FOIA releases:
29
- - **2023 release** (FY2012-FY2023): arrests, detentions, removals, RCA decisions
30
- - **2025 settlement release** (Sep 2023 - Oct 2025): arrests, detainers, detentions
31
-
32
- Every row has a `data_source` column (`release_2023` or `release_2025`) so you can filter by release. Overlapping records are deduplicated, preferring the richer 2025 data.
33
 
34
  Built with [ice-database](https://github.com/ian-nason/ice-database).
35
 
@@ -49,16 +45,33 @@ WHERE apprehension_date IS NOT NULL
49
  GROUP BY 1 ORDER BY 1 DESC LIMIT 12;
50
  ```
51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  ### Python
53
 
54
  ```python
55
  import duckdb
56
  con = duckdb.connect()
57
  con.sql("INSTALL httpfs; LOAD httpfs;")
58
- con.sql(\"\"\"
59
  ATTACH 'https://huggingface.co/datasets/Nason/ice-database/resolve/main/ice.duckdb'
60
  AS ice (READ_ONLY)
61
- \"\"\")
62
  con.sql("SELECT * FROM ice._metadata").show()
63
  ```
64
 
 
25
 
26
  **23,568,538 rows** across **6 tables** covering ICE arrests, detainers, detentions, removals, and custody decisions.
27
 
28
+ Combines the 2023 release with the August 2026 release. `data_source` identifies the release (`release_2023` or `release_2026_08`); overlapping windows are resolved as described in the changelog and build documentation. Identifiers are re-anonymized between releases and do not link across them.
 
 
 
 
29
 
30
  Built with [ice-database](https://github.com/ian-nason/ice-database).
31
 
 
45
  GROUP BY 1 ORDER BY 1 DESC LIMIT 12;
46
  ```
47
 
48
+ ### R with DBI and duckdb
49
+
50
+ Install the dependencies once with `install.packages(c("DBI", "duckdb"))`.
51
+
52
+ ```r
53
+ library(DBI)
54
+ con <- dbConnect(duckdb::duckdb())
55
+ dbExecute(con, "INSTALL httpfs")
56
+ dbExecute(con, "LOAD httpfs")
57
+ dbExecute(con, "ATTACH 'https://huggingface.co/datasets/Nason/ice-database/resolve/main/ice.duckdb' AS ice (READ_ONLY)")
58
+ dbGetQuery(con, "SELECT apprehension_date FROM ice.arrests LIMIT 5")
59
+ dbDisconnect(con, shutdown = TRUE)
60
+ ```
61
+
62
+ DuckDB uses HTTP range requests; queries run on your machine and may need substantial memory or download data. A `LIMIT` does not guarantee a small scan.
63
+
64
+
65
  ### Python
66
 
67
  ```python
68
  import duckdb
69
  con = duckdb.connect()
70
  con.sql("INSTALL httpfs; LOAD httpfs;")
71
+ con.sql("""
72
  ATTACH 'https://huggingface.co/datasets/Nason/ice-database/resolve/main/ice.duckdb'
73
  AS ice (READ_ONLY)
74
+ """)
75
  con.sql("SELECT * FROM ice._metadata").show()
76
  ```
77