vec_cast.tfd_reg {tf} | R Documentation |
vctrs
methods for tf
objects
Description
These functions are the extensions that allow tf
vectors
to work with vctrs
.
Usage
## S3 method for class 'tfd_reg'
vec_cast(x, to, ...)
## S3 method for class 'tfd_irreg'
vec_cast(x, to, ...)
## S3 method for class 'tfd_reg'
vec_cast.tfd_reg(x, to, ...)
## S3 method for class 'tfd_irreg'
vec_cast.tfd_reg(x, to, ...)
## S3 method for class 'tfb_spline'
vec_cast.tfd_reg(x, to, ...)
## S3 method for class 'tfb_fpc'
vec_cast.tfd_reg(x, to, ...)
## S3 method for class 'tfd_reg'
vec_cast.tfd_irreg(x, to, ...)
## S3 method for class 'tfd_irreg'
vec_cast.tfd_irreg(x, to, ...)
## S3 method for class 'tfb_spline'
vec_cast.tfd_irreg(x, to, ...)
## S3 method for class 'tfb_fpc'
vec_cast.tfd_irreg(x, to, ...)
## S3 method for class 'tfb_spline'
vec_cast(x, to, ...)
## S3 method for class 'tfb_fpc'
vec_cast(x, to, ...)
## S3 method for class 'tfb_spline'
vec_cast.tfb_spline(x, to, ...)
## S3 method for class 'tfb_fpc'
vec_cast.tfb_spline(x, to, ...)
## S3 method for class 'tfb_spline'
vec_cast.tfb_fpc(x, to, ...)
## S3 method for class 'tfb_fpc'
vec_cast.tfb_fpc(x, to, ...)
## S3 method for class 'tfd_reg'
vec_cast.tfb_spline(x, to, ...)
## S3 method for class 'tfd_irreg'
vec_cast.tfb_spline(x, to, ...)
## S3 method for class 'tfd_reg'
vec_cast.tfb_fpc(x, to, ...)
## S3 method for class 'tfd_irreg'
vec_cast.tfb_fpc(x, to, ...)
## S3 method for class 'tfd_reg'
vec_ptype2(x, y, ...)
## S3 method for class 'tfd_reg'
vec_ptype2.tfd_reg(x, y, ...)
## S3 method for class 'tfd_irreg'
vec_ptype2.tfd_reg(x, y, ...)
## S3 method for class 'tfb_spline'
vec_ptype2.tfd_reg(x, y, ...)
## S3 method for class 'tfb_fpc'
vec_ptype2.tfd_reg(x, y, ...)
## S3 method for class 'tfd_irreg'
vec_ptype2(x, y, ...)
## S3 method for class 'tfd_reg'
vec_ptype2.tfd_irreg(x, y, ...)
## S3 method for class 'tfd_irreg'
vec_ptype2.tfd_irreg(x, y, ...)
## S3 method for class 'tfb_spline'
vec_ptype2.tfd_irreg(x, y, ...)
## S3 method for class 'tfb_fpc'
vec_ptype2.tfd_irreg(x, y, ...)
## S3 method for class 'tfb_spline'
vec_ptype2(x, y, ...)
## S3 method for class 'tfb_spline'
vec_ptype2.tfb_spline(x, y, ...)
## S3 method for class 'tfb_fpc'
vec_ptype2.tfb_spline(x, y, ...)
## S3 method for class 'tfd_reg'
vec_ptype2.tfb_spline(x, y, ...)
## S3 method for class 'tfd_irreg'
vec_ptype2.tfb_spline(x, y, ...)
## S3 method for class 'tfb_fpc'
vec_ptype2(x, y, ...)
## S3 method for class 'tfb_spline'
vec_ptype2.tfb_fpc(x, y, ...)
## S3 method for class 'tfb_fpc'
vec_ptype2.tfb_fpc(x, y, ...)
## S3 method for class 'tfd_reg'
vec_ptype2.tfb_fpc(x, y, ...)
## S3 method for class 'tfd_irreg'
vec_ptype2.tfb_fpc(x, y, ...)
Arguments
x |
Vectors to cast. |
to |
Type to cast to. If |
... |
For |
y |
Vectors to cast. |
Details
Notes on vec_cast
:
Use tf_rebase()
to change the representations of tf
-vectors,
these methods are only for internal use –
automatic/implicit casting of tf
objects is tricky
because it's hard to determine automatically whether such an operation would
lose precision (different bases with different expressivity? different
argument grids?), and it's not generally clear which instances of which
tf
-subclasses should be considered the "richer" objects.
Rules for casting:
If the casted object's
domain
would not contain the entire originaldomain
, no casting is possible (would lose data).Every cast that evaluates (basis) functions on different
arg
values is a lossy cast, since it might lose precision (vctrs::maybe_lossy_cast
).As long as the casted object's
domain
contains the entire originaldomain
:every
tfd_reg
,tfd_irreg
ortfb
can always be cast into an equivalenttfd_irreg
(which may also change itsevaluator
anddomain
).every
tfd_reg
can always be cast totfd_reg
(which may change itsevaluator
anddomain
)every
tfb
can be cast losslessly totfd
(regular or irregular, note it's lossless only on the originalarg
-grid)
Any cast of a
tfd
intotfb
is potentially lossy (because we don't know how expressive the chosen basis is)Only
tfb
with identical bases and domains can be cast into one another losslessly
Value
for vec_cast
: the casted tf
-vector, for vec_ptype2
: the common prototype
See Also
vctrs::vec_cast()
, vctrs::vec_ptype2()