movhm: Create a heatmap based on movement data

Description Usage Arguments Value Examples

Description

Create a heatmap based on movement data

Usage

1
2
movhm(l, x, y, blocksize, margins, origin = NULL, consider.time = FALSE,
  time.transformation = sqrt, zero.to.na = TRUE, print = FALSE)

Arguments

l

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 l (string)

y

name of the column containing y-values in the data frames in l (string)

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.

zero.to.na

logical indicating whether to recode unvisited cells to NA (default is TRUE)

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
library(dplyr)
library(ggplot2)

data(movdat)

movhm(movdat, 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_Blues, na.value = rgb(0, 0, 0, 0)) +
  coord_fixed() +
  theme_movhm()

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