Package {groupedHyperframe.random}


Type: Package
Title: Simulated Point-Pattern via Vectorized Parameterization
Version: 0.3.1
Date: 2026-06-02
Description: An intuitive interface to simulate superimposed (marked) point patterns with vectorized parameterization of random point pattern and distribution of marks.
Encoding: UTF-8
License: GPL-2
Language: en-US
URL: https://github.com/tingtingzhan/rppp
Depends: R (≥ 4.6)
Imports: spatstat.geom, spatstat.random
Config/roxygen2/version: 8.0.0
Config/roxygen2/markdown: TRUE
NeedsCompilation: no
Packaged: 2026-06-02 15:18:20 UTC; tingtingzhan
Author: Tingting Zhan ORCID iD [aut, cre]
Maintainer: Tingting Zhan <tingtingzhan@gmail.com>
Repository: CRAN
Date/Publication: 2026-06-02 17:40:02 UTC

Superimposed (Marked) Point Pattern

Description

To simulate superimposed ppp.object(s), with none or one or multiple marks.

Usage

.rppp(..., win = square(), n = 1L, envir = parent.frame())

Arguments

...

one or more calls. The first call specifies the parameters to generate the x- and y-coords. The second to last calls, if available, specify the parameters to generate one or more marks.

win

owin.object, an observation window. Default value is the returned object of the function square

n

integer scalar, number of ppp.objects to generate. Default value is 1L.

envir

environment, in which to evaluate the ... dyn-dots argument. Default is the parent.frame.

Value

The function .rppp() returns a length-n solist, which also has a derived class 'ppplist'.

The returned ppp.object(s) contain only x- and y-coords, if only one call is present in the ... dyn-dots argument. Otherwise, they contain one or more marks according to the rest of the call(s) in the ... argument.

Note

The function name rppp() is too aggressive, which might be claimed in future by package spatstat.random. Therefore we name this function .rppp() as if it is hidden (see the parameter all.names of the function ls).

Examples

set.seed(12); .rppp(
 rMatClust(kappa = c(10, 5), mu = c(8, 4), scale = c(.15, .06))
)

set.seed(25); .rppp(
 rMatClust(kappa = c(10, 5), mu = c(8, 4), scale = c(.15, .06)), 
 rlnorm(meanlog = c(3, 5), sdlog = c(.4, .2)),
 rnbinom(size = 4, prob = .3) # shorter arguments recycled
)


Generate Random factor

Description

To generate random factor.

Usage

rfactor(n, prob, levels = names(prob) %||% as.character(seq_len(nprob)))

Arguments

n

integer scalar

prob

numeric vector, see function sample.int

levels

character vector, see function factor

Details

The function rfactor() is a wrapper of sample.int.

Value

The function rfactor() returns a factor.

Note

The function rmultinom is not what we need!

Examples

set.seed(12); rfactor(n = 20L, prob = c(4,2,3))
set.seed(12); rfactor(n = 20L, prob = c(a = 4, b = 2, c = 3))