These functions are particularly useful for situations
where you have made a copy and then
wish to perform further operations without creating more copies.
NA
and NaN
values are ignored though in some instances NaN
values may
be replaced with NA
.
These functions will not work on any classed objects, meaning they
only work on standard integer and numeric vectors and matrices.
When a copy has to be made
A copy is only made in certain instances, e.g. when passing an integer vector
to set_log()
. A warning will always be thrown in this instance alerting the user
to assign the output to an object because x
has not been updated by reference.
To ensure consistent and expected outputs, always assign the output to the same object,
e.g.
x <- set_log(x)
(do this)
set_log(x)
(don't do this)
x2 <- set_log(x)
(Don't do this either)
No copy is made here unless x is an integer vector.