get_surface {cpr} | R Documentation |
Get Surface
Description
Get Two-Dimensional Control Net and Surface from n-dimensional Control Nets
Usage
get_surface(x, margin = 1:2, at, n = 100)
Arguments
x |
a |
margin |
an integer identifying the marginal of the control net to slice
along. Only used when working |
at |
point value for marginals not defined in the |
n |
the length of sequence to use for interpolating the spline function. |
Value
a list with two elements
- cn
the control net
- surface
a data.frame with three columns to define the surface
See Also
Examples
## Extract the control net and surface from a cpr_cn object.
a_cn <- cn(log10(pdg) ~ btensor(list(day, age, ttm)
, df = list(15, 3, 5)
, bknots = list(c(-1, 1), c(45, 53), c(-9, -1))
, order = list(3, 2, 3))
, data = spdg)
cn_and_surface <- get_surface(a_cn, n = 50)
str(cn_and_surface, max.level = 2)
old_par <- par()
par(mfrow = c(1, 2))
with(cn_and_surface$cn,
plot3D::persp3D(unique(Var1),
unique(Var2),
matrix(z,
nrow = length(unique(Var1)),
ncol = length(unique(Var2))),
main = "Control Net")
)
with(cn_and_surface$surface,
plot3D::persp3D(unique(Var1),
unique(Var2),
matrix(z,
nrow = length(unique(Var1)),
ncol = length(unique(Var2))),
main = "Surface")
)
par(old_par)
[Package cpr version 0.4.0 Index]