fac.nested {dae}R Documentation

creates a factor, the nested factor, whose values are generated within those of the factor nesting.fac


Creates a nested factor whose levels are generated within those of the factor nesting.fac. All elements of nesting.fac having the same level are numbered from 1 to the number of different elements having that level.


fac.nested(nesting.fac, nested.levs=NA, nested.labs=NA, ...)



The factor within each of whose levels the created factor is to be generated.


Optional vector of levels for the factor. Any data value that does not match a value in levels will be NA in the factor. The default value of nested.levs is the list of numbers from 1 to the maximum replication of the levels of nesting.fac, represented as characters.


Optional vector of values to use as labels for the levels of the factor. The default is as.character(nested.levs).


Further arguments passed to the factor call creating the new factor.


A factor that is a character vector with class attribute "factor" and a levels attribute which determines what character strings may be included in the vector. It has a different level for of the values of the nesting.fac with the same level.


The levels of nesting.fac do not have to be equally replicated.


Chris Brien

See Also

fac.gen, fac.multinested in package dae, factor.


## set up factor A
A <- factor(c(1, 1, 1, 2, 2))

## create nested factor
B <- fac.nested(A)

[Package dae version 3.2-13 Index]