sf2turtles: From 'sf' to 'agentMatrix'

sf2turtlesR Documentation

From sf to agentMatrix

Description

Convert a sf object into an agentMatrix object.

Usage

sf2turtles(turtles_sf)

## S4 method for signature 'ANY'
sf2turtles(turtles_sf)

Arguments

turtles_sf

sf object of ⁠POINT geometry⁠ representing moving agents.

Details

If the turtles_sf does not contain the variables created with createTurtles(), these variables will be created with the default values as in createTurtles().

Value

AgentMatrix object representing the moving agents (coordinates and data) as contained in turtles_sf.

Author(s)

Sarah Bauduin

Examples

if (requireNamespace("sf", quietly = TRUE)) {
  turtles_sf1 <- sf::st_as_sf(
    cbind.data.frame(
      x = c(1, 2, 3), y = c(1, 2, 3),
      age = c(0, 0, 3), sex = c("F", "F", "M")
    ),
    coords = c("x", "y")
  )
  t1 <- sf2turtles(turtles_sf = turtles_sf1)
}


PredictiveEcology/NetLogoR documentation built on Jan. 31, 2024, 9:31 p.m.