mutate_with_speed | R Documentation |
act_tbl
with a speed columnThis returns a mutated act_tbl
with a new column
representing speed, in meters per second. See vignette("pace")
for
examples.
mutate_with_speed(df, method = c("2D", "3D"), lead = 0, lag = 1)
df |
An |
method |
If "2D" (default), ignores elevation. If "3D", includes elevation. "3D" is not often necessary, but for skiing activities is likely to yield a more accurate value. |
lead |
How far ahead to look for the "end" point. |
lag |
How far behind to look for the "start" point. |
The speed is determined by looking at the time difference between the current point and the previous point: hence, it is always NA for the first row in the data frame.
The lead
and lag
values are helpful to get "smoother" values, especially
if the provided activity file has GPS errors in it.
That same act_tbl
, but with a new speed
column,
in meters per second.
example_gpx_file <- system.file(
"extdata",
"running_example.gpx.gz",
package = "activatr"
)
example_act_tbl <- parse_gpx(example_gpx_file)
example_act_tbl_with_speed <- mutate_with_speed(example_act_tbl)
example_act_tbl_with_speed
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.