use: Use a set of levels.

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/use.R

Description

Descide which translation (and ordering) of a factor to use in a particular situation.

Usage

1
2
## S3 method for class 'fctr'
use(x, lang, reorder = FALSE, drop = TRUE, ...)

Arguments

x

A factor that was prepared by the function 'fctr'.

lang

A character string indicating which set of levels to be used.

reorder

A character string indicating the name of the set of levels to be used for ordering the levels.

drop

A logical, indicating if unused levels should be dropped.

...

Further arguments are perhaps needed in the future.

Details

FIXME: to follow

Value

An object of class fctr (that contains the class factor) and can be used as a standard factor.

Author(s)

Thomas Fabbro <thomas.fabbro@unibas.ch>

See Also

fctr

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
f <- c("a", "b", "c", "a", "a")
l <- data.frame(orig = c("a", "b", "c", "d"),
                lang1 = c("A", "B", "C", "D"),
                lang2 = c("first", "second", "third", "last"),
                order1 = c(5, 3, 4, 2),
                order2 = c("z", "y", "x", "w"),
                group1 =c("A", "B", "B", "B")
                )
sf <- fctr(f, l)
use(sf, "lang1")
use(sf, "lang2")
use(sf, "lang2", reorder = "order1")
use(sf, "lang1", drop = FALSE)

thofab/fctr documentation built on Nov. 5, 2019, 10:07 a.m.