Skip to content

Commit

Permalink
Tidied up, submitted to CRAN as 2.3-2
Browse files Browse the repository at this point in the history
  • Loading branch information
baddstats committed Feb 12, 2022
1 parent f3f17b6 commit 0a60b8e
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 24 deletions.
5 changes: 2 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: spatstat.geom
Version: 2.3-1.001
Date: 2022-02-11
Version: 2.3-2
Date: 2022-02-12
Title: Geometrical Functionality of the 'spatstat' Family
Authors@R: c(person("Adrian", "Baddeley",
role = c("aut", "cre"),
Expand All @@ -22,7 +22,6 @@ Maintainer: Adrian Baddeley <Adrian.Baddeley@curtin.edu.au>
Depends: R (>= 3.5.0), spatstat.data (>= 2.0-0), stats, graphics, grDevices, utils, methods
Imports: spatstat.utils (>= 2.2-0), deldir (>= 1.0-2), polyclip (>= 1.10-0)
Suggests: spatstat.core, spatstat.random, spatstat.linnet, maptools (>= 0.9-9), spatial, fftwtools (>= 0.9-8), spatstat (>= 2.0-0)
Additional_repositories: https://spatstat.r-universe.dev
Description: Defines spatial data types and supports geometrical operations
on them. Data types include point patterns, windows (domains),
pixel images, line segment patterns, tessellations and hyperframes.
Expand Down
4 changes: 2 additions & 2 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
CHANGES IN spatstat.geom VERSION 2.3-1.001
CHANGES IN spatstat.geom VERSION 2.3-2

OVERVIEW

o 'spatstat.geom' now suggests the package 'spatstat.random'.

o Updated help files.
o Updated help files to refer to 'spatstat.random'.


CHANGES IN spatstat.geom VERSION 2.3-1
Expand Down
32 changes: 23 additions & 9 deletions R/as.im.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# conversion to class "im"
#
# $Revision: 1.59 $ $Date: 2021/06/30 08:23:24 $
# $Revision: 1.60 $ $Date: 2022/02/12 06:09:33 $
#
# as.im()
#
Expand Down Expand Up @@ -361,9 +361,13 @@ wrangle2image <- function(values, template) {
template <- as.im(template)
tdim <- dim(template)
nt <- prod(tdim)
vdim <- dim(values) # may be NULL
if(!is.null(vlev <- levels(values))) {
## flatten and convert to integer
if(!is.factor(values)) values <- factor(values, levels=vlev)
values <- as.integer(values)
}
nv <- length(values)
vlev <- levels(values)
vdim <- dim(values) # may be NULL
vnames <- NULL
if(is.null(vdim)) {
## vector or factor of values
Expand Down Expand Up @@ -393,17 +397,27 @@ wrangle2image <- function(values, template) {
}
## values is now a matrix or array
if(is.matrix(values)) {
result <- template
result[drop=FALSE] <- values
if(!is.null(vlev)) values <- factor(values, labels=vlev)
result <- im(values,
xcol=template$xcol,
yrow=template$yrow,
xrange=template$xrange,
yrange=template$yrange,
unitname=unitname(template))
result <- result[W, drop=FALSE]
} else {
m <- dim(values)[3L]
result <- vector(mode="list", length=m)
for(i in seq_len(m)) {
Z <- template
Z[drop=FALSE] <- values[,,i]
Z <- Z[W, drop=FALSE]
result[[i]] <- Z
vi <- values[,,i]
if(!is.null(vlev)) vi <- factor(vi, labels=vlev)
Z <- im(vi,
xcol=template$xcol,
yrow=template$yrow,
xrange=template$xrange,
yrange=template$yrange,
unitname=unitname(template))
result[[i]] <- Z[W, drop=FALSE]
}
names(result) <- vnames
result <- as.solist(result)
Expand Down
4 changes: 2 additions & 2 deletions R/distancemetrics.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#'
#' Metrics on the spatial domain
#'
#' $Revision: 1.11 $ $Date: 2021/09/05 11:22:57 $
#' $Revision: 1.12 $ $Date: 2022/02/12 06:11:18 $
#'
#' An object of class 'metric' is essentially a named list of functions
#' where the names specify the tasks.
Expand Down Expand Up @@ -66,7 +66,7 @@ warn.no.metric.support <- function(caller, ..., metric) {

warn.unsupported.args <- function(unsup, ...) {
given <- list(...)
if(any(hit <- names(unsup) %in% names(given))) {
if(any(names(unsup) %in% names(given))) {
values <- resolve.defaults(given, unsup)[names(unsup)]
changed <- !mapply(identical, x=unsup, y=values)
if(any(changed)) {
Expand Down
6 changes: 3 additions & 3 deletions R/nnutils.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#'
#' Utilities for extracting nndist/nncross from distance matrices
#'
#' $Revision: 1.3 $ $Date: 2021/09/26 07:32:16 $
#' $Revision: 1.4 $ $Date: 2022/02/12 06:12:14 $


PDtoNN <- function(d, what=c("dist", "which"), k=1L, ...) {
Expand All @@ -17,7 +17,7 @@ PDtoNN <- function(d, what=c("dist", "which"), k=1L, ...) {
what <- match.arg(what, several.ok=TRUE)
want.dist <- "dist" %in% what
want.which <- "which" %in% what
want.both <- want.dist && want.which
## want.both <- want.dist && want.which

if(!missing(k)) {
# k can be a single integer or an integer vector
Expand Down Expand Up @@ -87,7 +87,7 @@ XDtoNN <- function(d, what=c("dist", "which"),
what <- match.arg(what, several.ok=TRUE)
want.dist <- "dist" %in% what
want.which <- "which" %in% what
want.both <- want.dist && want.which
## want.both <- want.dist && want.which

if(!missing(k)) {
# k can be a single integer or an integer vector
Expand Down
2 changes: 1 addition & 1 deletion inst/doc/packagesizes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ date version nhelpfiles nobjects ndatasets Rlines srclines
"2021-06-15" "2.2-0" 434 1159 0 33744 15115
"2021-10-09" "2.3-0" 440 1175 0 34553 15173
"2021-12-10" "2.3-1" 440 1176 0 34643 15173
"2022-02-11" "2.3-1.001" 440 1176 0 34643 15173
"2022-02-12" "2.3-2" 440 1176 0 34657 15173
2 changes: 1 addition & 1 deletion man/matchingdist.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
\author{
Dominic Schuhmacher
\email{dominic.schuhmacher@stat.unibe.ch}
\url{http://dominic.schuhmacher.name/}
URL \code{http://dominic.schuhmacher.name/}
}
\seealso{
\code{\link{pppdist}}
Expand Down
2 changes: 1 addition & 1 deletion man/pppdist.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
\author{
Dominic Schuhmacher
\email{dominic.schuhmacher@mathematik.uni-goettingen.de} \cr
\url{http://dominic.schuhmacher.name/}
URL \code{http://dominic.schuhmacher.name/}
}
\seealso{
\code{\link{pppmatching.object}}, \code{\link{matchingdist}},
Expand Down
2 changes: 1 addition & 1 deletion man/pppmatching.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
\author{
Dominic Schuhmacher
\email{dominic.schuhmacher@stat.unibe.ch}
\url{http://dominic.schuhmacher.name/}
URL \code{http://dominic.schuhmacher.name/}
}
\seealso{
\code{\link{pppmatching.object}}
Expand Down
2 changes: 1 addition & 1 deletion man/pppmatching.object.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
\author{
Dominic Schuhmacher
\email{dominic.schuhmacher@stat.unibe.ch}
\url{http://dominic.schuhmacher.name/}
URL \code{http://dominic.schuhmacher.name/}
}
\seealso{
\code{\link{matchingdist}},
Expand Down

0 comments on commit 0a60b8e

Please sign in to comment.