Data for Trails in the United States from the Rails-to-Trails Conservancy

Rail trail data from the excellent 'TrailLink' website, sponsored by the Rails-to-Trails Conservancy < https://www.traillink.com/>. Includes information (such as name, length, surface, reviews, and trailhead latitude and longitude) on 3,846 trails and 24,413 reviews in every state in the United States. Data can be used to better understand recreational trail use in the United States and for examples / teaching, particularly examples and teaching involving hierarchical or repeated measures data.


Travis build status

This R data package provides rail information about rail trails from the excellent TrailLink website, sponsored by the Rails-to-Trails Conservancy. Includes information (such as name, length, surface, and reviews) 3,846 trails in every state in the United States.

Installation

You can install railtrails with the install.packages() function.

install.packages("railtrails")

Loading the data

Here is how to load the data:

d <- railtrails::railtrails
d
#>    state name  distance surface category mean_review description n_reviews
#>    <chr> <chr>    <dbl> <chr>   <chr>          <int> <chr>       <chr>    
#>  1 AK    Chas…     14   Dirt, … Rail-Tr…           4 "\r\n     … 1 Reviews
#>  2 AK    Tony…     11   Asphalt Rail-Tr…           5 "The Tony … 5 Reviews
#>  3 AK    Bird…     13   Asphalt Rail-Tr…           5 "\r\n     … 3 Reviews
#>  4 AK    Camp…      7.5 Asphal… Greenwa…           5 "\r\n     … 3 Reviews
#>  5 AK    Goos…      1.5 Asphal… Greenwa…           0 "\r\n     … 0 Reviews
#>  6 AK    Home…      4   Asphalt Greenwa…           5 "On the so… 1 Reviews
#>  7 AK    Lani…      3.9 Asphal… Greenwa…           3 "The Lanie… 1 Reviews
#>  8 AK    Palm…      6.1 Gravel  Rail-Tr…           0 "As its na… 0 Reviews
#>  9 AK    Ship…      2.6 Asphalt Rail-Tr…           4 " \r\nShip… 1 Reviews
#> 10 AL    Chie…     33   Asphalt Rail-Tr…           5 "In northe… 77 Revie…
#> # ... with 3,836 more rows, and 3 more variables: raw_reviews <list>,
#> #   lat <dbl>, lng <dbl>

"Unnesting" trail reviews

You may want to "unnest" the list-column with reviews in the following way:

library(tidyr)
d <- railtrails::railtrails
d <- d %>% unnest(raw_reviews)
d
#> # A tibble: 24,413 x 11
#>    state name  distance surface category mean_review description n_reviews
#>    <chr> <chr>    <dbl> <chr>   <chr>          <int> <chr>       <chr>    
#>  1 AK    Chas…     14   Dirt, … Rail-Tr…           4 "\r\n     … 1 Reviews
#>  2 AK    Tony…     11   Asphalt Rail-Tr…           5 "The Tony … 5 Reviews
#>  3 AK    Tony…     11   Asphalt Rail-Tr…           5 "The Tony … 5 Reviews
#>  4 AK    Tony…     11   Asphalt Rail-Tr…           5 "The Tony … 5 Reviews
#>  5 AK    Tony…     11   Asphalt Rail-Tr…           5 "The Tony … 5 Reviews
#>  6 AK    Tony…     11   Asphalt Rail-Tr…           5 "The Tony … 5 Reviews
#>  7 AK    Bird…     13   Asphalt Rail-Tr…           5 "\r\n     … 3 Reviews
#>  8 AK    Bird…     13   Asphalt Rail-Tr…           5 "\r\n     … 3 Reviews
#>  9 AK    Bird…     13   Asphalt Rail-Tr…           5 "\r\n     … 3 Reviews
#> 10 AK    Camp…      7.5 Asphal… Greenwa…           5 "\r\n     … 3 Reviews
#> # ... with 24,403 more rows, and 3 more variables: lat <dbl>, lng <dbl>,
#> #   raw_reviews <int>

Shiny App

An interactive web application (Shiny) for finding the top-rated trails in each state is available here. The source code is in the app directory.

Notes

  • See more information about the variables with ?railtrails

  • If you like using this package, please consider visiting or even making a donation to the Rails to Trails Conservancy at via https://www.traillink.com/

  • The data was last updated 2018/2/2

  • Contributions are welcome. Pull requests and requests for features can be made on GitHub

  • Thank you to Bob Rudis for feedback that helped to improve this package

Code of conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

News

railtrails 0.1.1

  • Aaron Rosenberg, scientific developer and data manager at the National Oceanographic and Atmospheric Administration's National Centers from Environmental Information, successfully identified and SQUASHED ALL BUGS IN HIS PATH:
    • Rewrote geolocation scraping function to handle multiple location returns.
    • Forced improperly identified geolocations to NA (filtered lng > 0).
    • Updated n_review from character string to integer values.

railtrails 0.0.3

  • Address issue with duplicates trails - correct number is 3,846 trails and 24,413 reviews
  • Add latitude and longitude of trailheads (obtained via Google Maps; available for around 93% of trails)

railtrails 0.0.2

  • Updated railtrails - increased data from 11,420 trails to 11,628 trails from 69,673 reviews to 72,512 reviews
  • Fixed n_reviews column to be an integer instead of a character
  • Tidy scraping and processing files
  • Add cc0 license

railtrails 0.0.1

  • Added a NEWS.md file to track changes to the package.

  • Initial release

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("railtrails")

0.1.1 by Joshua Rosenberg, a year ago


https://github.com/jrosen48/railtrails


Report a bug at https://github.com/jrosen48/railtrails/issues


Browse source code at https://github.com/cran/railtrails


Authors: Joshua Rosenberg [aut, cre] , Aaron Rosenberg [ctb]


Documentation:   PDF Manual  


CC0 license


Imports tibble

Suggests dplyr, forcats, knitr, rmarkdown, stringr, tidyr


See at CRAN