We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unique.fact()
unique.default() rebuilds factors -- which leaves off the fact class
unique.default()
factors
fact
library(mark) str(unique(fact(1:4))) #> Factor w/ 4 levels "1","2","3","4": 1 2 3 4 unique.default #> function (x, incomparables = FALSE, fromLast = FALSE, nmax = NA, #> ...) #> { #> if (!is.object(x)) #> return(.Internal(unique(x, incomparables, fromLast, nmax))) #> if (is.factor(x)) { #> z <- .Internal(unique(x, incomparables, fromLast, min(length(x), #> nlevels(x) + 1L))) #> return(factor(z, levels = seq_len(nlevels(x)), labels = levels(x), #> ordered = is.ordered(x))) #> } #> z <- .Internal(unique(x, incomparables, fromLast, nmax)) #> if (inherits(x, "POSIXct")) #> structure(z, class = class(x), tzone = attr(x, "tzone")) #> else if (inherits(x, "Date")) #> structure(z, class = class(x)) #> else z #> } #> <bytecode: 0x0000000013dd7e18> #> <environment: namespace:base>
Created on 2022-01-20 by the reprex package (v2.0.1)
The text was updated successfully, but these errors were encountered:
With enhancements from #69 , this could be:
unique.fact <- function(x, ...) { att <- attributes(x) struct( att$uniques, class = att$class, levels = att$levels, unique = att$unique, na = att$na ) }
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
unique.default()
rebuildsfactors
-- which leaves off thefact
classCreated on 2022-01-20 by the reprex package (v2.0.1)
The text was updated successfully, but these errors were encountered: