movhm.diff: Create a difference heatmap based on movement data

Description Usage Arguments Value Examples

Description

Create a difference heatmap based on movement data

Usage

1
2
3
movhm.diff(lx, ly, x, y, difference = "relative", blocksize, margins,
  origin = NULL, consider.time = FALSE, time.transformation = sqrt,
  print = FALSE)

Arguments

lx

a list of data frames containing columns for x- and y-values

ly

a list of data frames containing columns for x- and y-values

x

name of the column containing x-values in the data frames in lx and ly (string)

y

name of the column containing y-values in the data frames in lx and ly (string)

difference

a character string specifying whether to compute "relative" (default) or "absolute" differences.

blocksize

scaling factor

margins

numeric vector of length 4 containing the margins (xmin, ymin, xmax, ymax)

origin

(optional) numeric vector of length 2 (x and y) of the position to be removed from the heatmap (e.g. starting position)

consider.time

logical indicating whether to count one subject multiple times in one cell, depending on the time the subject was inside the cell.

time.transformation

if consider.time is TRUE, then time.transformation specifies the function to be applied to the position * time frequencies (default is sqrt). Can also be NULL.

print

logical indicating if output should be printed via ggplot

Value

A data frame with x, y and f (freqency) columns ready for plotting with ggplot2

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
library(dplyr)
library(ggplot2)

data(movdat)

movhm.diff(movdat[1:21], movdat[22:42], x = "cart_x", y = "cart_y",
           blocksize = 50,  margins = c(-750, -2000, 100, 1550),
           origin = c(-120, -1000)) %>%
  ggplot(aes(x, y, fill = f)) +
  geom_raster() +
  scale_fill_gradientn(colours = scale_RdBu, na.value = rgb(0, 0, 0, 0),
                       limits = c(-.4, .4)) +
  coord_fixed() +
  theme_movhm()

dgromer/movhm documentation built on May 15, 2019, 7:22 a.m.