Packages 2023 Wrapped

r-pkg

A quick look at my R package updates this year.

Author
Published

December 21, 2023

With CRAN closing its submission queue for the holiday break tomorrow, it seems the right time to look over the past year. I maintain and contribute to quite a few packages on CRAN, primarily focused on social science data and methods. This year included adding 5 new packages to CRAN, with a minor shift towards tidy interfaces for web-based APIs. Below, I talk about some of the new packages, updates to existing packages, and then look at the downloads for all of my packages.

Updates on CRAN

New packages

I’ve added five new packages to CRAN this year.

apportion

apportion is a relatively simple package. It calculates apportionments, the allocation of seats to states based on population. It includes functions for the most common apportionment methods:

  • the Adams Method (app_adams())
  • the Balinski Young Method (app_balinski_young())
  • the Dean Method (app_dean())
  • the D’Hondt Method (app_dhondt())
  • the Hamilton-Vinton Method (app_hamilton_vinton())
  • the Huntington-Hill Method (app_huntington_hill())
  • the Jefferson Method (app_jefferson())
  • the Webster Method (app_webster())

crayons

crayons takes a few dozen packs of crayons and turns them into color palettes. The package itself is pretty thin, relying on scale_color_crayons() and scale_fill_crayons() to create the palettes.

library(ggplot2)
library(crayons)

mpg |>
  ggplot() + 
  geom_point(aes(displ, hwy, colour = class)) + 
  scale_color_crayons(palette = 'original') + 
  theme_bw()

gptzeror

In the peak of worries about students using ChatGPT, GPTZero offered an API for estimating if text was human or AI generated. I wrapped an R interface to this API in gptzeror. It seems to work somewhat well, but is far from perfect. The risk of false positives is really high, so I’m not using this without other substantial evidence.




feltr

feltr is a package for working with the Felt. It covers all of the API endpoints, which lets you upload shapes from R directly to Felt. You can delete them, update them, extract comments, and more. I covered an application of this package in a prior blog post on loosely focused on Dunkin Donuts in Cambridge.





bskyr

bskyr is a package for working with the Bluesky Social API. It’s focused largely on collecting tidy data from Bluesky. Given the decentralized nature of Bluesky, it seems like it has immense opportunity for social science research. You can design entire feeds as treatments, letting people push further in treatment arms without the same need for industry-academy partnerships as with Facebook or X/Twitter.

Of course, it also contains all of the tools for posting and otherwise interacting with Bluesky. I even have a small bot going which tracks CRAN Updates that I’ll cover soon in a holiday-times blog post. It’s run entirely through bskyr, which has been working even better than expected.

Updates to existing packages

My CRAN updates have not all been new packages, I also maintain a handful of packages. This year, I’ve made 14 submissions across 10 packages. 7 of these are related to the 5 new packages above (5 first submission + 2 updates).

Name Version Date Title
cvap 0.1.3 2023-03-17 Citizen Voting Age Population
redist 4.1.0 2023-03-19 Simulation Methods for Legislative Redistricting
redist 4.1.1 2023-04-03 Simulation Methods for Legislative Redistricting
geomander 2.2.1 2023-04-16 Geographic Tools for Studying Gerrymandering
cvap 0.1.4 2023-07-01 Citizen Voting Age Population
tinytiger 0.0.8 2023-10-17 Lightweight Interface to TIGER/Line Shapefiles
redistmetrics 1.0.7 2023-12-12 Redistricting Metrics

Updates to cvap and tinytiger added support for new years of Census Bureau data. redist and redistmetrics each saw primarily bug fixes and performance improvements, without any major changes. geomander similar saw mostly bug fixes. Its one update also drastically cleaned up the dependencies to make the package easier to install.

Package Downloads

By downloads, my most popular package was tinytiger, a project with Cory McCartan. This was designed as a low dependency alternative to tigris for accessing Census data, primarily as a dependency for other redistverse packages.

congress surprisingly comes in at number 2. I didn’t realize people were actually using this, but glad to see it. congress provides a tidy interface to Congress.gov’s API. You can get bill text, member info, committee documents, and more.

redist had a good year, taking the bronze medal. After being used for the winning side in Allen v. Milligan, it has another chance to make a difference in the ongoing South Carolina redistricting case.

The rest of the download counts are below, with bskyr coming in last with a mere 509 downloads.

We can also look at their trajectories over time. Below are the cumulative downloads for each package over the last year by day.

Similar to Spotify’s Wrapped, this only counts the number of packages downloaded in the past year. It’s interesting to see the count, but some of the ordering is time dependent. For example, bskyr really never had a chance, only being up for about a month. feltr, despite being on CRAN only since the summer, passed several packages. We can do some back of the envelope calculations to see what those packages might have done given the same 355 days as the other packages.1

Package Days Downloads
Raw Adjusted
gptzeror 200 2,982 5,293
feltr 169 2,479 5,207
bskyr 42 509 4,302
apportion 309 2,427 2,788
crayons 274 1,931 2,502

With these, we can see that feltr and gptzeror would have been in the running for the top few packages.

Packages goals for 2024

The first package I contributed to was redist, some years ago, under the watchful eyes of Ben Fifield. At that time, redist was a massive package, pushing the boundaries of what CRAN would accept, for size, compilation time, and number of direct dependencies. It handled everything all at once, from the algorithms to organizing outputs. After expanding some of the features in 2022, we had to split that out into redistmetrics. That’s grown further now, with geomander and censable to handle data inputs. ggredist extends the visualization side of things. Cory and I put together redistverse to tie all of these back together. At some point this year, we should put that on CRAN.

I’ve also been organizing a package for unified reading of voter files, vf. The goals of that package are to (1) efficiently read voter files and (2) standardize column names across states. A few states are done, but there’s a lot more to go. Once I have about 10 states covered, I’d like to put that on CRAN as well.2

Merry Christmas and a Happy New Year!

Footnotes

  1. Dear Spotify, please do something like this next year to account late releases like 1989 in October.↩︎

  2. Contributions welcome!↩︎

Citation

BibTeX citation:
@online{t._kenny2023,
  author = {T. Kenny, Christopher},
  title = {Packages 2023 {Wrapped}},
  date = {2023-12-21},
  url = {https://christophertkenny.com/posts/2023-12-21-cran-wrapped/},
  langid = {en}
}
For attribution, please cite this work as:
T. Kenny, Christopher. 2023. “Packages 2023 Wrapped.” December 21, 2023. https://christophertkenny.com/posts/2023-12-21-cran-wrapped/.