pkern_toString: Extract kernel parameters as plot-friendly strings

View source: R/pkern_pars.R

pkern_toStringR Documentation

Extract kernel parameters as plot-friendly strings

Description

Generate strings describing the kernels and parameter values in pars

Usage

pkern_toString(pars, nsig = 3)

Arguments

pars

character, character vector, or list (see details)

nsig

number of significant figures to print

Details

If pars is a list of the form returned by pkern_pars and pkern_optim, the function returns a list of strings: a kernel family string ('k'), dimension-wise kernel parameters (sub-list 'kp', with entries 'y' and 'x'), and a title containing the kernel family, nugget effect, and partial sill.

When pars is a character string, the function returns it unchanged. When pars is a vector of two character strings, it concatenates them with separator " x ". When pars is a list of kernel parameters for a single dimension, it returns a named list of two character strings: the kernel name (named entry 'k') and the parameter(s) (named entry 'kp'), parenthesized, in "name = value" format where "value" is rounded to nsig significant digits).

Value

a character string or list of them

Examples

kname = 'mat'
pkern_toString(kname)
pkern_toString(rep(kname, 2))
pkern_toString(list(k=kname))

gdim = c(10, 15)
pars = pkern_pars(gdim, kname)
pkern_toString(pars)


deankoch/pkern documentation built on Oct. 26, 2023, 8:54 p.m.