Fast and general represantation of a factor variable
Fast and general represantation of a factor variable.
ufactor(x) ## S3 method for class 'ufactor' x[i] ## S3 method for class 'ufactor' print(x,...)
x |
A vector with data. |
i |
An integer value/vector which is the index/indices to the element you want to access. |
... |
Anything the user want. |
This is a general implementation of factor structure. For access the fields of a "ufactor" use the "$" operator.
An object of class "ufactor". This object holds 2 fields:
levels: the levels of the variable in his initial type values: the values of the variable in his initial type
Manos Papadakis
R implementation and documentation: and Manos Papadakis <papadakm95@gmail.com>.
x <- rnorm(10) R.factor<- as.factor(x) Rfast.factor <- ufactor(x) identical(levels(R.factor),Rfast.factor$levels) # TRUE identical(as.numeric(R.factor),Rfast.factor$values) # TRUE x<-R.factor<-Rfast.factor<-NULL
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.