asfactormodel: Convert to factor, like model

Description Usage Arguments Value Note Author(s) Examples

View source: R/asfactormodel.R

Description

Convert factor-like entries in a data structure to factor, with factor as in factormodel.

Usage

1
asfactormodel(x, factormodel)

Arguments

x

A data structure. Currently only integer vectors or lists of vectors are supported.

factormodel

A data structure to serve as model for the factor specification. Currently, a factor or a vector of type character.

Value

a data structure of same type as x, with numeric vectors converted to factors.

Note

This functionality could go to R base function factor.

Should be extended to cover a wide range of data structures, and identify substructures for conversion.

Author(s)

Günther Sawitzki <gsawitzki@users.r-forge.r-project.org>

Examples

1
2
3
4
5
6
	data(sprof01lm)
	
xf <- asfactormodel(sprof01lm$stacks$nodes, sprof01lm$nodes$name)

# To get a character listing, use
sapply(xf, function (x) {as.character(x)} )

sprof documentation built on May 2, 2019, 4:45 p.m.