Lecture 13
Cornell University
INFO 5001 - Fall 2025
October 7, 2025
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 62027 400
2 02 Alaska medincome 89336 1374
3 04 Arizona medincome 76872 414
4 05 Arkansas medincome 58773 503
5 06 California medincome 96334 298
6 08 Colorado medincome 92470 483
7 09 Connecticut medincome 93760 669
8 10 Delaware medincome 82855 1234
9 11 District of Columbia medincome 106287 1803
10 12 Florida medincome 71711 282
# ℹ 42 more rows
Simple feature geometry with {sf}
Simple feature collection with 26 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 moe
1 36109000100 Census Tract 1; Tompkins County; New York medincome 40861 5663
2 36109000300 Census Tract 3; Tompkins County; New York medincome NA NA
3 36109002200 Census Tract 22; Tompkins County; New York medincome 62006 8155
4 36109000500 Census Tract 5; Tompkins County; New York medincome 92335 6203
5 36109001200 Census Tract 12; Tompkins County; New York medincome NA NA
6 36109001301 Census Tract 13.01; Tompkins County; New York medincome 43883 18383
7 36109000400 Census Tract 4; Tompkins County; New York medincome 61250 17491
8 36109002300 Census Tract 23; Tompkins County; New York medincome 83774 9843
9 36109000700 Census Tract 7; Tompkins County; New York medincome 64783 13868
10 36109001500 Census Tract 15; Tompkins County; New York medincome 80082 22146
geometry
1 MULTIPOLYGON (((-76.50839 4...
2 MULTIPOLYGON (((-76.48981 4...
3 MULTIPOLYGON (((-76.40229 4...
4 MULTIPOLYGON (((-76.48412 4...
5 MULTIPOLYGON (((-76.49984 4...
6 MULTIPOLYGON (((-76.48902 4...
7 MULTIPOLYGON (((-76.48973 4...
8 MULTIPOLYGON (((-76.66654 4...
9 MULTIPOLYGON (((-76.51177 4...
10 MULTIPOLYGON (((-76.53789 4...
Store your API key in .Renviron
R is useful for several reasons:
1. **Statistical Analysis**: Designed for statistical computing, it provides a wide range of
statistical tests and models.
2. **Data Visualization**: Offers powerful visualization libraries like ggplot2, making data easier
to understand.
3. **Extensive Libraries**: A rich ecosystem of packages for various data science tasks through
CRAN and Bioconductor.
4. **Data Manipulation**: Packages like dplyr and tidyr simplify data manipulation and cleaning.
5. **Community Support**: A strong, active community provides support and resources.
6. **Reproducible Research**: Tools like R Markdown promote reproducible coding practices.
These features make R a popular choice among statisticians, data analysts, and researchers.
ae-11
Instructions
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