assign.to.landmarks: split events into landmarks

Description Usage Arguments Value Author(s) Examples

View source: R/assign.to.landmarks.R

Description

creates a factor of within-event landmark assignments given a factor of event ids and a number of landmarks per event, in preparation for aggregation.

Usage

1
assign.to.landmarks(ids, n.landmarks)

Arguments

ids

a factor uniquely identifying each event, e.g. 111223333334444

n.landmarks

the number of landmarks per event

Value

a vector of landmark identities, e.g. 112121112221212

Author(s)

Benjamin N. Taft ben.taft@landmarkacoustics.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (ids, n.landmarks) 
{
    landmarks <- rep(NA, length(ids))
    for (e in sort(unique(ids))) {
        fe <- ids == e & is.finite(ids)
        n <- sum(fe)
        landmarks[fe] <- ceiling(n.landmarks * (1:n)/n)
    }
    return(invisible(landmarks))
  }

landmarkacoustics/SoundPoints-R documentation built on May 29, 2019, 9:14 a.m.