calcDistance: Calculate distance

Description Usage Arguments Details Value Examples

Description

Calculate distance moved between time steps

Usage

1

Arguments

list

A list of data frames, each of which has a column for dx and dy.

Details

Use the dx and dy columns in the servosphere data frames to calculate the distance moved between each time recording. If the data will be aggregated, it is recommended to aggregate the data before running this function.

Value

A list of data frames, each of which has a variable for the distance moved between each data recording.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
 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 <- calcDistance(servosphere)

servosphereR documentation built on May 15, 2019, 1:05 a.m.