knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
activatr
(pronounced like the word "activator") is a library for parsing GPX files into a standard format, and then manipulating and visualizing those files.
You can install the released version of activatr from CRAN with:
install.packages("activatr")
And the development version from GitHub with:
# install.packages("devtools") devtools::install_github("dschafer/activatr")
library(activatr)
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:
# Get the running_example.gpx file included with this package. filename <- system.file( "extdata", "running_example.gpx.gz", package = "activatr" ) df <- parse_gpx(filename)
knitr::kable(head(df, 5))
Once we have that data, we can visualize it atop a map:
library(ggmap) library(ggplot2)
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")
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")
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.