49  .rppp()

The examples in Chapter 49 require

library(groupedHyperframe.random)
# Loading required package: groupedHyperframe

Function groupedHyperframe.random::.rppp() (v0.2.0.20251221) implements the vectorized parameterization using advanced R language operations.

Listing 49.1 shows that the code snippet inside function .rppp() (Listing 4.1) cannot be taken outside function .rppp()!

Listing 49.1: Advanced: without language operation
tryCatch(expr = {
  spatstat.random::rMatClust(kappa = c(10, 5), mu = c(8, 4), scale = c(.15, .06))
}, error = identity)
# <simpleError: 'scale' should be a single number>

Listing 49.2 shows that the native pipe operator |> successfully passes the code snippet into function .rppp().

Listing 49.2: Advanced: language operation via native pipe |>
set.seed(12); r = rMatClust(kappa = c(10, 5), mu = c(8, 4), scale = c(.15, .06)) |>
  .rppp()
# Point-pattern simulated by `spatstat.random::rMatClust()`
# 

Listing 49.3 shows that the pipe operator magrittr::`%>%` (Bache and Wickham 2025, v2.0.4) does not pass the code snippet into function .rppp()!

Listing 49.3: Advanced: language operation via magrittr::`%>%`
suppressPackageStartupMessages(library(magrittr))
tryCatch(expr = {
  rMatClust(kappa = c(10, 5), mu = c(8, 4), scale = c(.15, .06)) %>% 
    .rppp()
}, error = identity)
# <notSubsettableError in i[[1L]]: object of type 'symbol' is not subsettable>