Description Usage Arguments Value Author(s) Examples
View source: R/assign.to.landmarks.R
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.
1 | assign.to.landmarks(ids, n.landmarks)
|
ids |
a factor uniquely identifying each event, e.g. |
n.landmarks |
the number of landmarks per event |
a vector of landmark identities, e.g. 112121112221212
Benjamin N. Taft ben.taft@landmarkacoustics.com
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))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.