File: points_within.Rd

package info (click to toggle)
r-cran-spp 1.16.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, trixie
  • size: 576 kB
  • sloc: cpp: 3,310; ansic: 365; makefile: 2
file content (96 lines) | stat: -rw-r--r-- 1,888 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
\name{points_within}
\alias{points_within}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
 Find points within
}
\description{
points_within substitutes the deprecated function 
"points.within"
}
\usage{
points_within(x, fs, fe, return.list = F, return.unique = F,
              sorted = F, return.point.counts = F, ...)
}
%- maybe also 'usage' for other objects documented here.
\arguments{
  \item{x}{
Parameter
}
  \item{fs}{
Parameter
}
  \item{fe}{
Parameter
}
  \item{return.list}{
Parameter
}
  \item{return.unique}{
Parameter
}
  \item{sorted}{
Parameter
}
  \item{return.point.counts}{
Parameter
}
  \item{\dots}{
Parameter
}
}
\value{
Parameter
}

%% ~Make other sections like Warning with \section{Warning }{....} ~
\examples{
\dontrun{
##---- 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 (x, fs, fe, return.list = F, return.unique = F, sorted = F, 
    return.point.counts = F, ...) 
{
    if (is.null(x) | length(x) < 1) {
        return(c())
    }
    if (!sorted) {
        ox <- rank(x, ties.method = "first")
        x <- sort(x)
    }
    se <- c(fs, fe)
    fi <- seq(1:length(fs))
    fi <- c(fi, -1 * fi)
    fi <- fi[order(se)]
    se <- sort(se)
    storage.mode(x) <- storage.mode(fi) <- storage.mode(se) <- "integer"
    if (return.unique) {
        iu <- 1
    }
    else {
        iu <- 0
    }
    if (return.list) {
        il <- 1
    }
    else {
        il <- 0
    }
    if (return.point.counts) {
        rpc <- 1
    }
    else {
        rpc <- 0
    }
    storage.mode(iu) <- storage.mode(il) <- storage.mode(rpc) <- "integer"
    result <- .Call("points_withinC", x, se, fi, il, iu, rpc)
    if (!sorted & !return.point.counts) {
        result <- result[ox]
    }
    return(result)
  }
}
}