Learn R Programming

fsr (version 1.0.0)

fsr_is_empty: Checking whether a pgeometry object is empty

Description

This function checks whether a pgeometry object is empty (i.e., if it does not contain components).

Usage

fsr_is_empty(pgo)

Arguments

pgo

A pgeometry object.

Value

A Boolean value that indicates if a pgeometry is empty.

Details

It checks if a pgeometry object has any component or not. If the number of components of a pgeometry object is equal to 0, then it returns TRUE. Otherwise, it returns FALSE.

Examples

Run this code
# NOT RUN {
# Creating an empty pgeometry object 
pgo1 <- create_empty_pgeometry("PLATEAULINE")

# Checking if it is empty
fsr_is_empty(pgo1)

# Creating a component to populate the pgeometry object

library(sf)
md <- 0.4
pts <- rbind(c(1, 1), c(2, 3), c(2, 1))

comp <- component_from_sfg(st_multipoint(pts), md)

# Adding the component to the pgeometry object
pgo1 <- spa_add_component(pgo1, comp)

# Checking if it is still empty
fsr_is_empty(pgo1) 

# }

Run the code above in your browser using DataLab