Lecture 13
Cornell University
INFO 5001 - Fall 2026
October 8, 2026
A set of rules and protocols for exchanging information between software applications
Packages with R functions written for existing APIs
Useful because
How to verify that a user or device has permission to access an API?
Different methods include:
Never store directly in an visible R script or Quarto document
Store in .Rprofile or .Renviron and exclude these files from a public Git repo
load_variables()# A tibble: 52 × 5
GEOID NAME variable estimate moe
<chr> <chr> <chr> <dbl> <dbl>
1 01 Alabama medincome 63999 399
2 02 Alaska medincome 92788 1232
3 04 Arizona medincome 79964 407
4 05 Arkansas medincome 60773 467
5 06 California medincome 99122 310
6 08 Colorado medincome 95470 578
7 09 Connecticut medincome 95781 732
8 10 Delaware medincome 84954 1251
9 11 District of Columbia medincome 109870 1937
10 12 Florida medincome 74568 284
# ℹ 42 more rows
Simple feature geometry with {sf}
Simple feature collection with 65 features and 5 fields
Geometry type: MULTIPOLYGON
Dimension: XY
Bounding box: xmin: -76.69666 ymin: 42.26298 xmax: -76.23782 ymax: 42.62742
Geodetic CRS: NAD83
First 10 features:
GEOID NAME variable estimate
1 361090010003 Block Group 3; Census Tract 10; Tompkins County; New York medincome 57688
2 361090002011 Block Group 1; Census Tract 2.01; Tompkins County; New York medincome 41611
3 361090013021 Block Group 1; Census Tract 13.02; Tompkins County; New York medincome 128438
4 361090013022 Block Group 2; Census Tract 13.02; Tompkins County; New York medincome 83750
5 361090012001 Block Group 1; Census Tract 12; Tompkins County; New York medincome NA
6 361090020003 Block Group 3; Census Tract 20; Tompkins County; New York medincome 93017
7 361090001001 Block Group 1; Census Tract 1; Tompkins County; New York medincome 43214
8 361090006004 Block Group 4; Census Tract 6; Tompkins County; New York medincome 239007
9 361090008002 Block Group 2; Census Tract 8; Tompkins County; New York medincome 66603
10 361090006001 Block Group 1; Census Tract 6; Tompkins County; New York medincome 172587
moe geometry
1 55244 MULTIPOLYGON (((-76.5083 42...
2 16121 MULTIPOLYGON (((-76.48865 4...
3 25966 MULTIPOLYGON (((-76.48434 4...
4 77696 MULTIPOLYGON (((-76.4747 42...
5 NA MULTIPOLYGON (((-76.49984 4...
6 21648 MULTIPOLYGON (((-76.3476 42...
7 4430 MULTIPOLYGON (((-76.49911 4...
8 130001 MULTIPOLYGON (((-76.52701 4...
9 17509 MULTIPOLYGON (((-76.50861 4...
10 62560 MULTIPOLYGON (((-76.49915 4...
Store your API key in .Renviron as ANTHROPIC_API_KEY
# Why R is Useful
R is particularly valuable for several reasons:
**Statistical computing**
- Built from the ground up for statistics and data analysis
- Huge library of statistical tests, models, and methods built-in
**Data visualization**
- Excellent graphics capabilities (base R, ggplot2)
- Easy to create publication-quality plots and charts
**Package ecosystem (CRAN)**
- Thousands of specialized packages for niche statistical/scientific needs
- Strong packages for bioinformatics, econometrics, social sciences
**Data wrangling**
- Tidyverse (dplyr, tidyr) makes data manipulation intuitive
- Good handling of data frames natively
**Free and open-source**
- No licensing costs (unlike SPSS, SAS, MATLAB)
- Active community support
**Reproducible research**
- R Markdown lets you combine code, output, and narrative in one document
- Good for creating reports, papers, and dashboards
**Best suited for:**
- Academic research
- Statistical analysis
- Data exploration and visualization
- Bioinformatics/genomics
**Less ideal for:**
- General-purpose software development
- Production systems at scale
- Tasks requiring heavy computation speed (though this is improving)
Want more detail on any of these points?
ae-11Instructions
ae-11 (repo name will be suffixed with your GitHub name).renv::restore() to install the required packages, open the Quarto document in the repo, and follow along and complete the exercises..Rprofile or .Renviron