pmaxC {hutilscpp} | R Documentation |
Parallel maximum/minimum
Description
Faster pmax()
and pmin()
.
Usage
pmaxC(
x,
a,
in_place = FALSE,
keep_nas = FALSE,
dbl_ok = NA,
nThread = getOption("hutilscpp.nThread", 1L)
)
pminC(
x,
a,
in_place = FALSE,
keep_nas = FALSE,
dbl_ok = NA,
nThread = getOption("hutilscpp.nThread", 1L)
)
pmax0(
x,
in_place = FALSE,
sorted = FALSE,
keep_nas = FALSE,
nThread = getOption("hutilscpp.nThread", 1L)
)
pmin0(
x,
in_place = FALSE,
sorted = FALSE,
keep_nas = FALSE,
nThread = getOption("hutilscpp.nThread", 1L)
)
pmaxV(
x,
y,
in_place = FALSE,
dbl_ok = TRUE,
nThread = getOption("hutilscpp.nThread", 1L)
)
pminV(
x,
y,
in_place = FALSE,
dbl_ok = TRUE,
nThread = getOption("hutilscpp.nThread", 1L)
)
pmax3(x, y, z, in_place = FALSE)
pmin3(x, y, z, in_place = FALSE)
Arguments
x |
|
a |
|
in_place |
|
keep_nas |
|
dbl_ok |
|
nThread |
|
sorted |
|
y , z |
|
Value
Versions of pmax
and pmin
, designed for performance.
When in_place = TRUE
, the values of x
are modified in-place.
For advanced users only.
The differences are:
pmaxC(x, a)
andpminC(x, a)
Both
x
anda
must be numeric anda
must be length-one.
Note
This function will always be faster than pmax(x, a)
when a
is
a single value, but can be slower than pmax.int(x, a)
when x
is short.
Use this function when comparing a numeric vector with a single value.
Use in_place = TRUE
only within functions when you are sure it is safe, i.e. not a
reference to something outside the environment.
By design, the functions first check whether x
will be modified before
allocating memory to a new vector. For example, if all values in x
are
nonnegative, the vector is returned.
Examples
pmaxC(-5:5, 2)
pmaxC(1:4, 5.5)
pmaxC(1:4, 5.5, dbl_ok = TRUE)
# pmaxC(1:4, 5.5, dbl_ok = FALSE) # error