Learn R Programming

activatr

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 with:

install.packages("activatr")

And the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("dschafer/activatr")

Usage

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:

# Get the running_example.gpx file included with this package.
filename <- system.file(
  "extdata",
  "running_example.gpx.gz",
  package = "activatr"
)

df <- parse_gpx(filename)
latloneletime
37.80405-122.426717.02018-11-03 14:24:45
37.80406-122.426716.82018-11-03 14:24:46
37.80408-122.426617.02018-11-03 14:24:48
37.80409-122.426617.02018-11-03 14:24:49
37.80409-122.426517.22018-11-03 14:24:50

Visualizing

Once we have that data, we can visualize it atop a map:

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")

For more details on how to use the package, check out vignette("activatr").

Copy Link

Version

Install

install.packages('activatr')

Monthly Downloads

268

Version

0.2.1

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Daniel Schafer

Last Published

July 27th, 2024

Functions in activatr (0.2.1)

running_example_ggmap

Precomputed example ggmap
act_tbl-class

act_tbl class
pace_formatter

Format pace durations
mutate_with_speed

Augments an act_tbl with a speed column
speed_to_mile_pace

Convert speed to mile pace
activatr

activatr: Utilities for Parsing and Plotting Activities
summary.act_tbl

Summarizes act_tbl objects.
localize_to_time_zone

Localize time zone values
get_ggmap_from_df

Get a map for a given act_tbl
parse_gpx

Parses a GPX file into a act_tbl
parse_tcx

Parses a TCX file into a act_tbl