An R package for National Transit Database data
For the past few months I have been working on my first R package. Like with many packages, my motivation came from repeatedly doing the same data cleaning operations, getting annoyed by it, and then writing code to make it less annoying. Now the package is available on CRAN and it’s time for a brief post about the package.
ntdr
currently only has one purpose: Retrieve the latest monthly National Transit Database ridership data and provide it in a tidy data format. Rather than downloading an unwieldy Excel file with hundreds of columns, just use the get_ntd()
command to get data on ridership and related metrics.
The best place to start is the package’s website, especially the “Get Started” article. The package itself is simple, but the article provides some useful information about the NTD data and its quirks and limitations. Here’s a very simple example to install the package, retrieve bus ridership in Madison, and plot the data:
This is my very first package, and I appreciate feedback, feature requests and bug reports!
This package would not exist or be on CRAN without the wonderful “R Packages” book by Hadley Wickham and Jennifer Bryan. Writing a package was intimidating for me, but the book systematically walks you through every step of the process and the tools that make the process quite straightforward in the end. Even the submission to CRAN – about which you can read many frustrating stories – turned out to be easy. Just follow the process outlined in the book!
Text and figures are licensed under Creative Commons Attribution CC BY-SA 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".
For attribution, please cite this work as
Kliems (2023, May 31). Harald Kliems: `ntdr 0.3.0`: Now available on CRAN. Retrieved from https://haraldkliems.netlify.app/posts/2023-05-31-ntdr-an-r-package-for-transit-data/
BibTeX citation
@misc{kliems2023`ntdr, author = {Kliems, Harald}, title = {Harald Kliems: `ntdr 0.3.0`: Now available on CRAN}, url = {https://haraldkliems.netlify.app/posts/2023-05-31-ntdr-an-r-package-for-transit-data/}, year = {2023} }