-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.Rmd
67 lines (51 loc) · 2.37 KB
/
index.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
title: "Bryan Crenshaw's 52 Saunters Challenge 2020"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE,
warning = FALSE,
message = FALSE)
# For more info: < https://bookdown.org/yihui/rmarkdown/rmarkdown-site.html >
# Also: https://resources.github.com/whitepapers/github-and-rstudio/
```
Inspired by the [52 Hike Challenge](https://www.52hikechallenge.com/), I am taking my own approach, by going on a "saunter" on a different trail averaging one for every week of 2020. These hikes will be summarized in a table below with links to the route on tracking software sites, in case you are interested in taking your own saunter along those trails. If you are curious about why I use the term saunter, instead of hike, it comes from a quote by John Muir, who also preferred the term saunter (see the [*About* page](about.html) for details).
---
## Outings Log ##
```{r LoadLibraries}
library(openxlsx)
suppressPackageStartupMessages(library(dplyr))
library(tidyr)
library(knitr)
library(stringr)
library(kableExtra)
```
```{r Functions}
# blank_href <- function()
```
```{r Input Data}
hikes <- read.xlsx('data/52-Hike-Challenge-Hiking-Log_2020.xlsx', startRow = 6)
names(hikes) <- c('hike_num', 'date', 'park_area', 'trail', 'distance', 'time', 'elevation_gain', 'difficulty', 'recording_app', 'recording_html', 'notes')
hikes <-
hikes %>%
mutate(date = convertToDate(date)) %>%
drop_na(date, park_area, trail)
# Prepare df for output
hikes_out <-
hikes %>%
mutate(date = format(date, "%d-%b-%y")) %>%
mutate(Trail = cell_spec(trail, "html", link = recording_html)) %>%
rename(Date = date, Park = park_area) %>%
select(Date, Park, Trail) %>%
mutate(Trail = ifelse(str_detect(Trail, 'href="NA"'),
str_extract(Trail, "(?<=\\>).+(?=\\<)"),
Trail)
)
# ^^^ In the final mutate above, the cell_spec() can generate a link with no target. Therefore,
# the blank links (e.g. href="NA") were converted to just the trail title without a link to nowhere.
# Output to table
knitr::kable(hikes_out, caption = NULL, escape = FALSE) %>%
kableExtra::kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive"),
# full_width = FALSE,
position = "left")
```