Skip to contents

Provide a sf object with a POINT at each record corresponding to a release point or a data.frame for a areal release, specifying which variables contain the required information. Or, extract the release events used in a sit object.

Usage

sit_revents(x, ...)

# S3 method for sf
sit_revents(x, date = "date", colour = "colour", n = "n", species = NULL, ...)

# S3 method for data.frame
sit_revents(x, date = "date", colour = "colour", n = "n", species = NULL, ...)

# S3 method for sit_revents
c(...)

# S3 method for sit
sit_revents(x, type = c("point", "areal"), ...)

Arguments

x

Object of class sf with POINT elements to be imported, or a data.frame with information about areal releases, or object of class sit to extract release events from.

...

Used to pass arguments to specific method.

date

Character string representing a date and optionally the time, in the RFC 3339 format (a variation of the ISO 8601 format), i.e., 2021-12-31 or 2019-11-23 15:00.

colour

Character string. Colour of the release.

n

Numeric. Natural number. Number of individuals released.

species

Optional character. Released species.

type

Character vector. Which types of release events to retrieve. Either point or areal or both (default).

Value

A object of class sit_revents which can be used in sit(). sit_revents objects can be concatenated together with c(), in order to import a mixture of point and areal releases into a sit object. See examples.

Methods (by class)

  • sf: Imports point release data.

  • data.frame: Imports areal release data.

  • sit_revents: Concatenate release events.

  • sit: Extracts release events.

See also

Examples

point_releases <- sit_revents(
  sf::st_as_sf(
    data.frame(
      x = 1:3,
      y = 3:1,
      date = c("2019-11-25", "2019-12-01", "2019-12-13"),
      colour = c("yellow", "red", "blue"),
      n = 1e4
    ),
    coords = c("x", "y")
  )
)

areal_release <- sit_revents(
  data.frame(
    x = 1, y = 1,
    date = "2019-12-21",
    colour = "pink",
    n = 1e4
  )
)

(c(point_releases, areal_release)) # also a `sit_revent` object
#>   id  type site_id       date colour     n    geometry
#> 1  1 point       1 2019-11-25 yellow 10000 POINT (1 3)
#> 2  2 point       2 2019-12-01    red 10000 POINT (2 2)
#> 3  3 point       3 2019-12-13   blue 10000 POINT (3 1)
#> 4  4 areal       4 2019-12-21   pink 10000 POINT EMPTY