sterm: The names of 'mgcv' smooth terms

View source: R/sterm.R

stermR Documentation

The names of mgcv smooth terms

Description

This function defines the names of mgcv smooth terms based on the type of smooth and the variable name(s). This is useful, for instance, for extracting term-specific predictions from a predict.gam or predict.bam object.

Usage

sterm(s = "ti", vars = c("hourofday", "julian_day"))

Arguments

s

A character vector specifying the type of smooth term (e.g. "s", "te", "ti", "crs", "cr" etc.)

vars

A character vector or list specifying variable names.

Author(s)

Edward Lavender

Examples

# Supplying variables as a list:
sterm(s = "s", vars = list("th_interp"))
sterm(s = "ti", vars = list("hourofday", "julian_day"))
# Supplying variables as character vectors:
sterm(s = "s", vars = "th_interp")
sterm(s = "s", vars = c("hourofday", "julian_day"))


edwardlavender/utils.add documentation built on Dec. 14, 2024, 8:11 a.m.