Skip to content

Commit 57df89a

Browse files
committed
Documented difflong()
1 parent f1545a1 commit 57df89a

File tree

7 files changed

+76
-8
lines changed

7 files changed

+76
-8
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: spatstat.utils
2-
Version: 3.2-0.003
3-
Date: 2025-12-29
2+
Version: 3.2-0.004
3+
Date: 2026-01-04
44
Title: Utility Functions for 'spatstat'
55
Authors@R: c(person("Adrian", "Baddeley",
66
role = c("aut", "cre"),

NEWS

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11

2-
CHANGES IN spatstat.utils VERSION 3.2-0.003
2+
CHANGES IN spatstat.utils VERSION 3.2-0.004
33

44
OVERVIEW
55

6-
o Internal improvements.
6+
o Lagged difference of long vector.
7+
8+
NEW FUNCTIONS
9+
10+
o difflong
11+
Calculates diff() for a long vector.
712

813
CHANGES IN spatstat.utils VERSION 3.2-0
914

inst/doc/packagesizes.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ date version nhelpfiles nobjects ndatasets Rlines srclines
3131
"2025-05-15" "3.1-4" 42 193 0 3689 2462
3232
"2025-07-17" "3.1-5" 42 194 0 3703 2462
3333
"2025-09-20" "3.2-0" 42 195 0 3716 2462
34-
"2025-12-29" "3.2-0.003" 42 196 0 3754 2535
34+
"2026-01-04" "3.2-0.004" 43 196 0 3754 2535

inst/info/packagesizes.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ date version nhelpfiles nobjects ndatasets Rlines srclines
3131
"2025-05-15" "3.1-4" 42 193 0 3689 2462
3232
"2025-07-17" "3.1-5" 42 194 0 3703 2462
3333
"2025-09-20" "3.2-0" 42 195 0 3716 2462
34-
"2025-12-29" "3.2-0.003" 42 196 0 3754 2535
34+
"2026-01-04" "3.2-0.004" 43 196 0 3754 2535

man/difflong.Rd

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
\name{difflong}
2+
\alias{difflong}
3+
\title{
4+
Lagged Differences for a Long Vector
5+
}
6+
\description{
7+
Calculate the lagged difference of a long vector.
8+
}
9+
\usage{
10+
difflong(x, drop = TRUE)
11+
}
12+
\arguments{
13+
\item{x}{
14+
Numeric or integer vector.
15+
}
16+
\item{drop}{
17+
Logical value. See Details.
18+
}
19+
}
20+
\details{
21+
A \sQuote{long vector} is a vector with more than
22+
\eqn{2^31 - 1} elements (the largest possible 32-bit integer).
23+
Long vectors are supported in \R on 64-bit computer systems.
24+
This feature was introduced in \R version 3.0.0.
25+
26+
Although long vectors are permitted, not all functions in \R
27+
have been extended to handle long vectors.
28+
29+
The base \R function \code{\link{diff}} currently does not handle
30+
a long vector, and may cause the entire \R
31+
session to be terminated.
32+
33+
The function \code{difflong} is a temporary replacement
34+
for \code{\link{diff}} in the simplest case:
35+
\code{difflong(x)} is a replacement for \code{diff(x)}.
36+
37+
If \code{drop=TRUE} (the default),
38+
the result of \code{difflong(x)} is equivalent to \code{diff(x)},
39+
a vector with length equal to \code{length(x) - 1}.
40+
If \code{drop=FALSE} the result of \code{difflong(x, FALSE)} has the
41+
same length as \code{x}; the first entry is zero, and the subsequent
42+
entries are equivalent to \code{diff(x)}.
43+
}
44+
\value{
45+
A vector of the same type as \code{x}.
46+
}
47+
\author{
48+
\adrian.
49+
}
50+
\seealso{
51+
\code{\link{diff}}
52+
}
53+
\examples{
54+
x <- sample(1:5)
55+
diff(x)
56+
difflong(x)
57+
}
58+
\keyword{manip}

man/spatstat.utils-internal.Rd

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
\alias{choptext}
1515
\alias{choptextline}
1616
\alias{complaining}
17-
\alias{difflong}
1817
\alias{distpl}
1918
\alias{distppl}
2019
\alias{distppll}
@@ -127,7 +126,6 @@ check.satisfies(cond, xname, should, context, fatal, warn)
127126
choptext(\dots, prefix, indent)
128127
choptextline(st, w, prefix, indent)
129128
complaining(whinge, fatal, value)
130-
difflong(x, drop)
131129
distpl(p, l)
132130
distppl(p, l)
133131
distppll(p, l, mintype, method, listit)

tests/numerical.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33

44
require(spatstat.utils)
55

6+
#' difflong() calculates diff() for long vectors
7+
#' Test agreement on a short vector
8+
n <- sample((-1000):1000, 1000, replace=TRUE)
9+
stopifnot(all(diff(n) == difflong(n)))
10+
x <- as.double(n)
11+
stopifnot(all(diff(x) == difflong(x)))
12+
613
#' validity of orderstats, orderwhich
714
x <- unique(runif(100))
815
if(!all(orderstats(x, 2:5) == sort(x)[2:5]))

0 commit comments

Comments
 (0)