krsp_rattlemap: Map behaviour records on grid

Description Usage Arguments Details Value Examples

View source: R/krsp-rattlemap.r

Description

Create an interative plot of rattle or feeding behaviour on given grid and in given year. In the plot, squirrels are colour coded, sex is distinguished by different symbols, and further information is available in a tool tip on mouseover. Plotting is done using ggvis, which creates an HTML object that pops up in the Viewer pane in RStudio.

Usage

1
2
krsp_rattlemap(con, grid, year, date_range, locx_range, locy_range, middens,
  data)

Arguments

con

Connection to KRSP database

grid

character; a single grid to map

year

integer

date_range

vector of starting and ending dates as Date objects or character representation of date in YMD format (e.g. "2016-05-25"); only show records that are between these dates.

locx_range

vector of length 2 giving upper and lower bounds of x locs, either as character (e.g. c("A", "H.5")) or numeric (e.g. 5.5, 10).

locy_range

vector of length 2 giving upper and lower bounds of y locs, either as character (e.g. c("5", "10.5")) or numeric (e.g. 5, 10.5).

middens

character; whether to show middens from the August ("august") census, the May census ("may"), or not display middens at all ("none").

data

logical; if TRUE return data frame instead of plotting

Details

Records can be further filtered to a date range using the date_range arguments, which is a vector of the from and to dates, respectively, both of which must be in the same year. If date_range is provided is ignored.

Value

Displays and returns a ggvis plot of rattle locations, unless data is TRUE, in which case a data frame is returned and nothing is plotted.

Examples

1
2
3
4
5
6
7
8
9
con <- krsp_connect()
krsp_rattlemap(con, "JO", 2014, data = TRUE) %>%
  head()
krsp_rattlemap(con, "KL", 2015)
# choose date range
krsp_rattlemap(con, "AG", date_range = c("2014-04-01", "2014-04-10"))
# choose loc range
krsp_rattlemap(con, "JO", 2010, locx_range = c("D", "H"),
  locy_range = c(5, 10))

mstrimas/krsp documentation built on May 23, 2019, 8:16 a.m.