convertNonAlphanumeric: Prepare string for regular expressions (backslash for all...

View source: R/util.R

convertNonAlphanumericR Documentation

Prepare string for regular expressions (backslash for all non-letter and non-digit characters)

Description

Prepare string for regular expressions (backslash for all non-letter and non-digit characters)

Usage

convertNonAlphanumeric(text)

Arguments

text

A text string (smooth term label) that needs to be converted to a regular expression.

Value

A regular expression string.

Author(s)

Jacolien van Rij

See Also

Other Utility functions: corfit(), diff_terms(), find_difference(), missing_est(), modeledf(), observations(), print_summary(), refLevels(), res_df(), summary_data(), timeBins()

Examples

data(simdat)
# Model for illustrating coefficients:
m0 <- bam(Y ~ s(Time) + s(Subject, bs='re') 
+ s(Time, Subject, bs='re'), data=simdat)

# get all coefficients:
coef(m0)
# to get only the Subject intercepts:
coef(m0)[grepl(convertNonAlphanumeric('s(Subject)'), names(coef(m0)))]
# to get only the Subject slopes:
coef(m0)[grepl(convertNonAlphanumeric('s(Time,Subject)'), names(coef(m0)))]


itsadug documentation built on June 17, 2022, 5:05 p.m.