summary.act_tbl: Summarizes 'act_tbl' objects.

View source: R/act_tbl.R

summary.act_tblR Documentation

Summarizes act_tbl objects.

Description

summary.act_tbl returns a tibble with canonical information about the activity.

Usage

## S3 method for class 'act_tbl'
summary(object, full = FALSE, units = c("imperial", "metric"), ...)

Arguments

object

an object for which a summary is desired

full

Whether every column should be included, and filled with NA if missing. Most useful to ensure the tibble has the same shape for every file, allowing eventual use of dplyr::bind_rows() or purrr::map_dfr() to create a full summary data set.

units

Which units should be used?

  • "imperial" returns distance in miles, pace in minutes per mile, and elevation in feet.

  • "metric" returns distance in kilometers, pace in minutes per kilometer, and elevation in meters.

...

Additional arguments.

Details

This is designed to allow for easy creation of activity summary data sets by mapping summary over each act_tbl then using dplyr::bind_rows(), purrr::map_dfr(), or equivalent to create a complete data set.

Value

Returns a tibble with a single row, containing a summary of the given act_tbl.

Examples

example_gpx_file <- system.file(
  "extdata",
  "running_example.gpx.gz",
  package = "activatr"
)
act_tbl <- parse_gpx(example_gpx_file)
summary(act_tbl)

## Not run: 
files <- list.files("path/to/many/files", pattern = "*.gpx")
gpxs <- files |> purrr::map(\(f) parse_gpx(f))
summaries <- gpxs |> purrr::map_dfr(\(g) summary(g, full = TRUE))

## End(Not run)


activatr documentation built on Aug. 22, 2023, 9:12 a.m.