Converts a data.frame to an object of class SpatialPointsBreeding

Description

Converts a data.frame to a SpatialPointsBreeding object. The SpatialPointsBreeding class extends SpatialPointsDataFrame with three extra slots defining the id (i.e. nest or breeding box) and the pair identity (i.e. male and female), respectively.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
SpatialPointsBreeding(data, proj4string, coords = ~x + y, breeding = ~male + female, id)
  
## S4 method for signature 'SpatialPointsBreeding,missing'
plot(x, pch = 20, axes = FALSE, add = FALSE, 
                  xlim = NULL, ylim = NULL, ..., cex = 1, col = "grey", 
                  lwd = 1, bg = "grey90")  

## S4 method for signature 'SpatialPointsBreeding,eppMatrix'
plot(x, y, pch = 20, axes = FALSE, add = FALSE, 
                   xlim = NULL, ylim = NULL, ..., cex = 1, col = "grey", 
                   col.epp = "red", 
                   lwd = 1, lty = 2, bg = "grey90")  

Arguments

data

a data.frame containing the coordinates (e.g. "x", "y"), the location id, and the pair identity (e.g. "male", "female") together with any other optional variables (e.g. individuals or nest traits).

proj4string

A CRS object containing a valid proj4 string. See CRS proj4string for details.

coords

Formula specifying which columns in object are the spatial coordinates. Argument passed to coordinates

id

Integer specifying the location id (e.g. nest box number, den ID).

breeding

Formula defining the male and female ID in that order (in the form of e.g. ~male+female).

x

a SpatialPointsBreeding object

y

an eppMatrix object

pch

see plot.default

axes

see plot.default

add

see plot.default

xlim

see plot.default

ylim

see plot.default

...

further arguments to pass to plot(as(x, "Spatial")

cex

see plot.default

col

see plot.default

col.epp

extra-pair partners color

lwd

see plot.default

lty

see plot.default

bg

see plot.default

Value

Item of the class 'SpatialPointsBreeding' with 8 slots.

id

Location ID (see input)

male

(Male IDs.)

female

Female IDs.

data

A data.frame containing all the optional variables (except location and individual ID-s)

coords.nrs

see SpatialPoints

coords

coordinates

bbox

see Spatial

proj4string

see CRS

See Also

epp

Examples

1
2
3
4
5
6
7
8
9
d = data.frame(
  x = c(4, 17, 16, 41, 41, 43, 86, 62, 71, 92, 95,53, 34, 27, 53), 
  y = c(3, 18, 36, 6, 18, 50, 3, 21, 40, 43, 57, 62, 62, 45, 37), 
  id = 1:15,male = paste0('m', 1:15), female = paste0('f', 1:15), 
    stringsAsFactors = FALSE)

b = SpatialPointsBreeding(d, id = 'id', breeding = ~ male+female)	

plot(b)