smooths produced in a gam using s(x, bs="cp") do not return a smooth type with the function gratia::smooth_type(smooth). here is some example code that reproduces this issue:
library(gratia)
library(mgcv)
data <- data.frame(x = c(1:100),
y=c(1:100))
gam <- gam(y~s(x, bs="cp"), data=data, method="REML")
smooth <- get_smooth(gam, "s(x)")
class(smooth) # class of smooth appropriately reported
#[1] "cpspline.smooth" "mgcv.smooth"
cp_smooth_type <- smooth_type(smooth)
#throws error Error in smooth_type.default(smooth) : Unknown type of smooth
Version of R: 4.4.1
Version of mgcv: mgcv_1.9-1
Version of gratia: gratia_0.9.2
This is fixed following #297 in the development version. If you install from GitHub or my r-universe, you will get the devel version. Instructions are in the README.md
smooths produced in a gam using
s(x, bs="cp")
do not return a smooth type with the functiongratia::smooth_type(smooth)
. here is some example code that reproduces this issue:Version of R: 4.4.1 Version of mgcv: mgcv_1.9-1 Version of gratia: gratia_0.9.2