cut_with_nas | R Documentation |
NA
sLike base::cut()
, but creates a level representing the missing values.
cut_with_nas(x, .missing = "Unknown", ...)
x |
A |
.missing |
The name of the level representing the |
... |
further arguments passed to |
A factor
.
Discussed in the Stack Overflow question, "cut() a variable with missing values"
Will Beasley
w <- c(0L, NA_integer_, 22:25, NA_integer_, 40)
breaks <- c(0, 25, 50)
labels <- c("lower", "upper")
cut_with_nas(w, breaks=2)
cut_with_nas(w, breaks=breaks, labels=labels)
cut_with_nas(w, breaks=breaks )
cut_with_nas(w, breaks=breaks , include.lowest=TRUE)
cut_with_nas(w, breaks=breaks , include.lowest=TRUE, right=FALSE)
cut_with_nas(w, breaks=breaks , right=FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.