stpm {stopp}R Documentation

Create stpm and stlpm objects for marked point patterns storage

Description

This function creates a stpm object as a dataframe with 3 + m columns: x, y, t, and m columns to store different marks. If also the linear network L, of class linnet, is provided, a stlp object is created instead.

Usage

stpm(df, names = NULL, L)

Arguments

df

A matrix with three columns + m marks

names

Factor string to name the marks columns.

L

Optional. The linear network of class linnet. If provided, the function returns a stlpm object.

Value

An stpm or stlppm object, depending on whether or not an object of class linnet is provided for the L argument.

Author(s)

Nicoletta D'Angelo

Examples



set.seed(2)
df <- data.frame(cbind(runif(100), runif(100), runif(100), rpois(100, 15),
rpois(100, 30)))

stpm1 <- stpm(df)

## Categorical marks

set.seed(2)
dfA <- data.frame(x = runif(100), y = runif(100), t = runif(100), 
                  m1 = rnorm(100), m2 = rep(c("C"), times = 100))
dfB <- data.frame(x = runif(50), y = runif(50), t = runif(50), 
                  m1 = rnorm(25), m2 = rep(c("D"), times = 50))

stpm2 <- stpm(rbind(dfA, dfB), names = c("continuous", "dichotomous"))

## Linear network

set.seed(2)
dfL <- data.frame(cbind(runif(100, 0, 0.85), runif(100, 0, 0.85), runif(100), 
                       rpois(100, 15)))

stlpm1 <- stpm(dfL, L = chicagonet)




[Package stopp version 0.2.3 Index]