Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ library(lubridate)
Strava (http://labs.strava.com) is a data rich platform to collect, store, and use physical activity data. One key challenge faced by many sporting enthusiasts is how to effectively take control of their own data to make novel and interesting visualizations or depictions of one's hard work. In some senses, Strava makes this easy by packing your data for you with options on how you wish to view your achievements. For the DIY'er, the story is a little more complicated. As we've outlined above with the reading in of your personal Strava data, there is a consistent theme of following key steps to have our data ready for your most creative projects.

The following code chunk takes data from the prior API calls and tidy's a dataframe for use. There are a few functions embedded that whittle down the incoming data to it's most essential features and also excludes activities that you don't do very often (e.g., that one time you went stand up paddle boarding and recorded it on Strava).

```{r secondstep, echo=TRUE}
#reading in data for sandbox
# Will be deleted for final project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,14 @@
- Strava
---

<script src="{{< blogdown/postref >}}index_files/header-attrs/header-attrs.js"></script>


<pre><code>## [1] &quot;See things here&quot;</code></pre>
<pre><code>## [1] 17</code></pre>
<p>Extra filler text until we know what we’re doing…</p>
<p>What is Lorem Ipsum?
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
<p>Why do we use it?
It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using ‘Content here, content here’, making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for ‘lorem ipsum’ will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).</p>
<p>Where does it come from?
Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of “de Finibus Bonorum et Malorum” (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, “Lorem ipsum dolor sit amet..”, comes from a line in section 1.10.32.</p>
<p>The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from “de Finibus Bonorum et Malorum” by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.</p>
<p>Where can I get some?
There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don’t look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn’t anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.</p>
<pre><code>##
## ── Column specification ────────────────────────────────────────────────────────
<p>Strava (<a href="http://labs.strava.com" class="uri">http://labs.strava.com</a>) is a data rich platform to collect, store, and use physical activity data. One key challenge faced by many sporting enthusiasts is how to effectively take control of their own data to make novel and interesting visualizations or depictions of one’s hard work. In some senses, Strava makes this easy by packing your data for you with options on how you wish to view your achievements. For the DIY’er, the story is a little more complicated. As we’ve outlined above with the reading in of your personal Strava data, there is a consistent theme of following key steps to have our data ready for your most creative projects.</p>
<p>The following code chunk takes data from the prior API calls and tidy’s a dataframe for use. There are a few functions embedded that whittle down the incoming data to it’s most essential features and also excludes activities that you don’t do very often (e.g., that one time you went stand up paddle boarding and recorded it on Strava).</p>
<pre class="r"><code>#reading in data for sandbox
# Will be deleted for final project
strav_data &lt;- read_csv(here(&quot;content/post/2021-04-16-functional-programming-with-strava-data/data&quot;, &quot;strav_csv.csv&quot;))</code></pre>
<pre><code>## Parsed with column specification:
## cols(
## .default = col_double(),
## commute = col_logical(),
Expand All @@ -49,5 +40,20 @@
## visibility = col_character(),
## device_watts = col_logical()
## # ... with 2 more columns
## )
## ℹ Use `spec()` for the full column specifications.</code></pre>
## )</code></pre>
<pre><code>## See spec(...) for full column specifications.</code></pre>
<pre class="r"><code>#initial function for tidying Stravadata
tidyfunc &lt;- strav_data %&gt;%
select(where(~length(unique(.)) &gt; 1)) %&gt;%
# selecting unique values
clean_names() %&gt;%
mutate_if(is.numeric, ~round(., 2)) %&gt;%
# rounding values to remove clutter for visualization
mutate(type = as.factor(type)) %&gt;%
separate(start_date_local, c(&quot;date&quot;,&quot;time&quot;), sep = &quot; &quot;) %&gt;%
select(-start_date) %&gt;%
#separating out date &amp; time; excluding multiple dates and times
filter(elapsed_time &gt; 0,
max_speed &gt; average_speed)
# removes activities with no duration (which rules out manually entered activities where no time is supplied) and also incorrect calculations where Strava defines the an average speed that is higher than the max speed (this most often occurs in swimming)</code></pre>
<p>After our data has a first-pass-tidy, we want to sort out which activities occurred frequently enough that they would be useful to display visually. In our view, having 98% of your activities comprise three different types (e.g., hiking, running, and biking), and 2% of your activities comprise 4 types (e.g., stand-up paddle boarding, walking, rock climbing, and jump rope), then your visualization will be skewed. It is certainly possible to select specific activities to visualize, and this will be something you can read more about later. For now, we’re going to pair down our data to activity types that occur most commonly.</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
title: "Real-World Applications for Strava Data"
author: "Makayla Whitney, Joe Swinehart, Janette Avelar, David Fainstein"
date: "5/19/2021"
slug: functional-programming-with-strava-data
categories: R
tags:
- R
- Strava
---



<p>This will produce an overlay of the Strava data (specifically bike rides) on top of Eugene, Oregon bike paths. City planners use Strava data to understand high-use areas within the city to help avoid accidents involving bikers and runners.</p>
<pre><code>##
## ── Column specification ────────────────────────────────────────────────────────
## cols(
## .default = col_double(),
## commute = col_logical(),
## display_hide_heartrate_option = col_logical(),
## external_id = col_character(),
## flagged = col_logical(),
## from_accepted_tag = col_logical(),
## has_heartrate = col_logical(),
## has_kudoed = col_logical(),
## heartrate_opt_out = col_logical(),
## manual = col_logical(),
## map.id = col_character(),
## map.summary_polyline = col_character(),
## name = col_character(),
## private = col_logical(),
## start_date = col_datetime(format = &quot;&quot;),
## start_date_local = col_datetime(format = &quot;&quot;),
## timezone = col_character(),
## trainer = col_logical(),
## type = col_character(),
## visibility = col_character(),
## device_watts = col_logical()
## # ... with 2 more columns
## )
## ℹ Use `spec()` for the full column specifications.</code></pre>
14 changes: 14 additions & 0 deletions peer_review_LF
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Peer Review Notes

Lea Frank
May 25th, 2021

General comments:
- I wasn't able to install rStrava with my version of R (4.1.0) so I would put a note about it in the read me file. I wasn't able to render the "jd_post.Rmd" without it
- Maybe on the about page talk about what format the final project is in (e.g. is this a tutorial?)
- Really cool data! Can't wait to see the final products

Index File:
- Is the tidyfunc variable supposed to be a function? Right now it just saves out the tidied dataframe
- I really appreciate the commenting in your code, it's really helpful!
- I would maybe name the file something other than "index" so that it's easier to match with the blog post. For example, giving it the same title as the blog post title
Empty file added public/.gitkeep
Empty file.
Loading