remove_basis: Removes basis functions

remove_basisR Documentation

Removes basis functions

Description

Takes an object of class Basis and returns an object of class Basis with selected basis functions removed

Usage

remove_basis(Basis, rmidx)

## S4 method for signature 'Basis,ANY'
remove_basis(Basis, rmidx)

## S4 method for signature 'Basis,SpatialPolygons'
remove_basis(Basis, rmidx)

Arguments

Basis

object of class Basis

rmidx

indices of basis functions to remove. Or a SpatialPolygons object; basis functions overlapping this SpatialPolygons object will be retained

See Also

auto_basis for automatically constructing basis functions and show_basis for visualising basis functions

Examples

library(sp)
df <- data.frame(x = rnorm(10),
                 y = rnorm(10))
coordinates(df) <- ~x+y
G <- auto_basis(plane(),df,nres=1)
data.frame(G) # Print info on basis

## Removing basis functions by index
G_subset <- remove_basis(G, 1:(nbasis(G)-1))
data.frame(G_subset)

## Removing basis functions using SpatialPolygons
x <- 1
poly <- Polygon(rbind(c(-x, -x), c(-x, x), c(x, x), c(x, -x), c(-x, -x)))
polys <- Polygons(list(poly), "1")
spatpolys <- SpatialPolygons(list(polys))
G_subset <- remove_basis(G, spatpolys)
data.frame(G_subset)

FRK documentation built on Sept. 11, 2024, 7:14 p.m.