summaryAvgVelocity: Calculate average velocity

Description Usage Arguments Details Value Examples

View source: R/summarize_variables.R

Description

Calculate the average velocity for a movement path.

Usage

1
summaryAvgVelocity(list, summary.df = NA)

Arguments

list

A list of data frames, each of which has a column for velocity.

summary.df

The data frame object within which you are storing path summary variables. The default is NA if you do not currently have a summary data frame object started. When set to NA the function will create a new summary data frame. When an object is provided, the function will merge the summary data frame with the new data.

Details

Calculate the average velocity for a movement path. The units on velocity are equal to the distance units used to record the data per second.

Value

The inputed summary data frame or a new data frame if summary.df is NA

Examples

 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
# If a summary data frame has not been started

 servosphere <- list(data.frame(id = rep(1, 200),
                                stimulus = rep(c(0, 1), each = 100),
                                dT = sample(8:12, 200, replace = TRUE),
                                dx = runif(200, 0, 5),
                                dy = runif(200, 0, 5),
                                treatment = rep("a", 200),
                                date = rep("2032018", 200)),
                     data.frame(id = rep(2, 200),
                                stimulus = rep(c(0, 1), each = 100),
                                dT = sample(8:12, 200, replace = TRUE),
                                dx = runif(200, 0, 5),
                                dy = runif(200, 0, 5),
                                treatment = rep("b", 200),
                                date = rep("2032018", 200)))
servosphere <- calcVelocity(servosphere)

summary_df <- summaryAvgVelocity(servosphere, summary.df = NA)
# If a summary data frame has been started

summary_df <- data.frame(id = c(1, 2),
                         treatment = c("a", "b"),
                         date = c("2032018", "2042018"),
                         stimulus = c(0, 0))

summary_df <- summaryAvgVelocity(servosphere, summary.df = summary_df)

wittja01/ballr documentation built on Sept. 13, 2020, 10:02 p.m.