| pmaxC | R Documentation |
Faster pmax() and pmin().
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)
x |
|
a |
|
in_place |
|
keep_nas |
|
dbl_ok |
|
nThread |
|
sorted |
|
y, z |
|
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) and pminC(x, a)Both x and a must be numeric and
a must be length-one.
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.
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.