| setdiff_ {cheapr} | R Documentation |
Extra utilities
Description
Extra utilities
Usage
setdiff_(x, y, dups = TRUE)
intersect_(x, y, dups = TRUE)
cut_numeric(
x,
breaks,
labels = NULL,
include.lowest = FALSE,
right = TRUE,
dig.lab = 3L,
ordered_result = FALSE,
...
)
x %in_% table
x %!in_% table
enframe_(x, name = "name", value = "value")
deframe_(x)
na_rm(x)
sample_(x, size = cpp_vec_length(x), replace = FALSE, prob = NULL)
Arguments
x |
A vector or data frame. |
y |
A vector or data frame. |
dups |
Should duplicates be kept? Default is |
breaks |
See |
labels |
See |
include.lowest |
See |
right |
See |
dig.lab |
See |
ordered_result |
See |
... |
Further arguments passed onto |
table |
See |
name |
The column name to assign the names of a vector. |
value |
The column name to assign the values of a vector. |
size |
See |
replace |
See |
prob |
See |
Details
intersect_() and setdiff_() are faster and more efficient
alternatives to intersect() and setdiff() respectively.
enframe_() and deframe_() are faster alternatives to
tibble::enframe() and tibble::deframe() respectively.
cut_numeric() is a faster and more efficient alternative to
cut.default().
Value
enframe()_ converts a vector to a data frame.
deframe()_ converts a 1-2 column data frame to a vector.
intersect_() returns a vector of common values between x and y.
setdiff_() returns a vector of values in x but not y.
cut_numeric() places values of a numeric vector into buckets, defined
through the breaks argument and returns a factor unless labels = FALSE,
in which case an integer vector of break indices is returned.
%in_% and %!in_% both return a logical vector signifying if the values of
x exist or don't exist in table respectively.
na_rm() is a convenience function that removes NA values and
empty rows in the case of data frames.
For more advanced NA handling, see ?is_na.
sample_() is an alternative to sample() that natively samples
data frame rows through sset(). It also does not have a special case when
length(x) is 1.