ufactor: Fast and general represantation of a factor variable

View source: R/ufactor.R

Fast and general - untyped represantation of a factor variableR Documentation

Fast and general represantation of a factor variable

Description

Fast and general represantation of a factor variable.

Usage

ufactor(x)
## S3 method for class 'ufactor'
x[i]
## S3 method for class 'ufactor'
print(x,...)

Arguments

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.

Details

This is a general implementation of factor structure. For access the fields of a "ufactor" use the "$" operator.

Value

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

Author(s)

Manos Papadakis

R implementation and documentation: and Manos Papadakis <papadakm95@gmail.com>.

See Also

colVars, factor

Examples

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

Rfast documentation built on Nov. 9, 2023, 5:06 p.m.