Extra utilities
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,
...
)
# S3 method for integer64
cut(x, ...)
x %in_% table
x %!in_% table
enframe_(x, name = "name", value = "value")
deframe_(x)
sample_(x, size = vector_length(x), replace = FALSE, prob = NULL)
val_insert(x, value, n = NULL, prop = NULL)
na_insert(x, n = NULL, prop = NULL)
vector_length(x)
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.
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.
val_insert
inserts scalar values randomly into your vector.
Useful for replacing lots of data with a single value.
na_insert
inserts NA
values randomly into your vector.
Useful for generating missing data.
vector_length
behaves mostly like NROW()
except
for matrices in which it matches length()
.
A vector or data frame.
A vector or data frame.
Should duplicates be kept? Default is TRUE
.
See ?cut
.
See ?cut
.
See ?cut
.
See ?cut
.
See ?cut
.
See ?cut
.
Further arguments passed onto cut
or set.seed
.
See ?collapse::fmatch
The column name to assign the names of a vector.
The column name to assign the values of a vector.
See ?sample
.
See ?sample
.
See ?sample
.
Number of scalar values (or NA
) to insert
randomly into your vector.
Proportion of scalar values (or NA
) values to insert
randomly into your vector.
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()
.