Skip to content

Instantly share code, notes, and snippets.

@njtierney
Created October 12, 2020 02:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save njtierney/05b7c70fd6dcd43e6f0ca807cb6905cd to your computer and use it in GitHub Desktop.
Save njtierney/05b7c70fd6dcd43e6f0ca807cb6905cd to your computer and use it in GitHub Desktop.
bushwalk_url <- "http://trailswa.com.au/trails/trail-types/bush-walk/"

library(polite)
library(rvest)
#> Loading required package: xml2
library(janitor)
#> 
#> Attaching package: 'janitor'
#> The following objects are masked from 'package:stats':
#> 
#>     chisq.test, fisher.test
library(tidyverse)

bushwalk_data <- bow(bushwalk_url) %>% 
  scrape() %>% 
  html_table() %>% 
  pluck(1) %>% 
  as_tibble() %>% 
  clean_names() %>% 
  mutate(length_km = parse_number(length))
#> Warning: Problem with `mutate()` input `length_km`.
#> ℹ 7 parsing failures.
#> row col expected actual
#>  78  -- a number     --
#> 109  -- a number     --
#> 255  -- a number     --
#> 299  -- a number     --
#> 328  -- a number     --
#> ... ... ........ ......
#> See problems(...) for more details.
#> 
#> ℹ Input `length_km` is `parse_number(length)`.
#> Warning: 7 parsing failures.
#> row col expected actual
#>  78  -- a number     --
#> 109  -- a number     --
#> 255  -- a number     --
#> 299  -- a number     --
#> 328  -- a number     --
#> ... ... ........ ......
#> See problems(...) for more details.

bushwalk_data %>% 
  filter(length_km > 15) %>% 
  arrange(-length_km) %>% 
  tibble::rowid_to_column("number") %>% 
  knitr::kable()
number trail_name top_trail rating region time length difficulty length_km
1 Bibbulmun Track, Kalamunda to Albany This is a Top Trail 5 Reviews Perth, South West Multiple day 1000km Moderate 1000.0
2 Easy Walk Trail, Ellis Brook Valley, Gosnells 1 Reviews Perth 1-3 hours (Loop) 750 metreskm Easy 750.0
3 Pilgrim Trail, Subiaco to New Norcia 2 Reviews Perth Multiple day 202km Moderate 202.0
4 Cape to Cape Track, Margaret River This is a Top Trail 4 Reviews South West Multiple day 123km Moderate 123.0
5 Kep Track, Mundaring to Northam 5 Reviews Perth Multiple day 75km Easy 75.0
6 Denmark to Nornalup Heritage Rail Trail 3 Reviews South West Full day 54.5km Easy 54.5
7 Coastal Plain Walk Trail, Yanchep NP to Melaleuca CP 3 Reviews Perth Multiple day 52km Difficult 52.0
8 Collie Darkan Rail Trail 4 Reviews South West Multiple day 47km Easy 47.0
9 Railway Reserves Heritage Trail, Perth Hills This is a Top Trail 14 Reviews Perth Full day (Loop) 41km Easy 41.0
10 Old Timberline and Sidings Rail Trails, Nannup This is a Top Trail 2 Reviews South West Multiple day (Loop) 37km Easy 37.0
11 Mamang Trail, Fitzgerald River NP 1 Reviews Golden Outback Multiple day 31 km Moderate 31.0
12 Yaberoo Budjara Heritage Trail, Yanchep 3 Reviews Perth Multiple day 28km Moderate 28.0
13 Hakea Walk Trail, East Fitzgerald NP This is a Top Trail 2 Reviews Golden Outback Multiple day 23km Moderate 23.0
14 Wadandi Track, Margaret River This is a Top Trail 4 Reviews South West Full day 23km Easy 23.0
15 Yange Kep Bidi, Perth Western Suburbs Be first to review! Perth Full day 21.2km Easy 21.2
16 Wiilman Bilya Trail, Collie 1 Reviews South West Full day 19.7km Moderate 19.7
17 Bibbulmun Wellington Spur Trail, Wellington NP Be first to review! South West Multiple day 19km Moderate 19.0
18 King Jarrah Heritage Trail, Lane Poole, Dwellingup 2 Reviews Perth Half day (Loop) 18km Difficult 18.0
19 Cockatoo Walk Trail, Yanchep NP 1 Reviews Perth Full day (Loop) 17.5km Moderate 17.5
20 Wardun Beelier Bidi, Perth Western Suburbs Be first to review! Perth Half day (Loop) 17.4kmkm Easy 17.4
21 Coastal Trail, Cape Le Grand NP This is a Top Trail 3 Reviews Golden Outback Multiple day 17km Difficult 17.0
22 Greenough River Nature Trail 2 Reviews Coral Coast Full day (Loop) 17km Moderate 17.0
23 Kitty’s Gorge, Serpentine NP, Jarrahdale This is a Top Trail 17 Reviews Perth Half day 16.5km Moderate 16.5
24 Sullivan Rock to Mt Cooke, Darling Range This is a Top Trail 3 Reviews Perth Full day 16.5km Difficult 16.5
25 Bush to Beach Trail, Perth Western Suburbs Be first to review! Perth Half day 16.3km Easy 16.3
26 Greenbushes Loop 2 Reviews South West Half day (Loop) 16km Moderate 16.0

Created on 2020-10-12 by the reprex package (v0.3.0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment