-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
91 lines (68 loc) · 2.45 KB
/
README.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, opts, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# activatr <a href="https://dschafer.github.io/activatr/"><img src="man/figures/logo.png" align="right" height="139" /></a>
<!-- badges: start -->
[![CRAN status](https://www.r-pkg.org/badges/version/activatr)](https://cran.r-project.org/package=activatr)
[![R-CMD-check](https://github.com/dschafer/activatr/workflows/R-CMD-check/badge.svg)](https://github.com/dschafer/activatr/actions)
[![Codecov test coverage](https://codecov.io/gh/dschafer/activatr/branch/master/graph/badge.svg)](https://app.codecov.io/gh/dschafer/activatr?branch=master)
<!-- badges: end -->
`activatr` (pronounced like the word "activator") is a library for parsing GPX files into a standard format, and then manipulating and visualizing those files.
## Installation
You can install the released version of activatr from [CRAN](https://CRAN.R-project.org) with:
```{r install_release, eval = FALSE}
install.packages("activatr")
```
And the development version from [GitHub](https://github.com/) with:
```{r install_dev, eval = FALSE}
# install.packages("devtools")
devtools::install_github("dschafer/activatr")
```
## Usage
```{r library}
library(activatr)
```
### Parsing
`activatr` contains function to parse, analyze, and display GPX activities. The most basic thing you can do is parse a GPX file into a tibble:
```{r filename}
# Get the running_example.gpx file included with this package.
filename <- system.file(
"extdata",
"running_example.gpx.gz",
package = "activatr"
)
df <- parse_gpx(filename)
```
```{r table, echo=FALSE, results='asis'}
knitr::kable(head(df, 5))
```
### Visualizing
Once we have that data, we can visualize it atop a map:
```{r silentlibrary, echo = FALSE, message = FALSE, warning = FALSE}
library(ggmap)
library(ggplot2)
```
```{r finalplot_display, eval = FALSE}
library(ggmap)
library(ggplot2)
ggmap::ggmap(get_ggmap_from_df(df)) +
theme_void() +
geom_path(aes(x = lon, y = lat), linewidth = 1, data = df, color = "red")
```
```{r finalplot_run, echo = FALSE}
library(ggmap)
library(ggplot2)
ggmap::ggmap(running_example_ggmap) +
theme_void() +
geom_path(aes(x = lon, y = lat), linewidth = 1, data = df, color = "red")
```
For more details on how to use the package, check out `vignette("activatr")`.