Debian Codegraph @

man/measurement-autolevel.Rd

raw
1 \name{measurement_autolevel}
2 \alias{measurement_autolevel}
3 \alias{measurement_autolevel,ANY-method}
4 \alias{measurement_autolevel,item.vector-method}
5 \alias{measurement_autolevel,data.set-method}
6 \title{Automatically Adapt Measurement Levels}
7 \description{
8 The generic function \code{measurement_autolevel} changes the measurement
9 levels of "item" objects to "nominal" or "ordinal", if
10 the proportion of its values that have labels is above a certain
11 threshold.
12 }
13 \usage{
14 measurement_autolevel(x, \dots)
15 \S4method{measurement_autolevel}{ANY}(x, \dots) # Returns its argument as is
16 \S4method{measurement_autolevel}{item.vector}(x,
17 to=getOption("measurement.adapt.default","nominal"),
18 threshold=getOption("measurement.adapt.threshold",.75),
19 \dots)
20 \S4method{measurement_autolevel}{data.set}(x,
21 to=getOption("measurement.adapt.default","nominal"),
22 threshold=getOption("measurement.adapt.threshold",.75),
23 except=NULL,
24 only=NULL,
25 \dots)
26 }
27 \arguments{
28 \item{x}{an object from class "item.vector" or "data.set".}
29 \item{to}{a character vector, the target measurement level}
30 \item{threshold}{the proportion of values, if reached the target
31 measurement level is set}
32 \item{except}{a vector with variable names, either as symbols
33 (without quotation marks) or character strings (with quotation
34 markes), the variables in the data set that are not to be
35 changed by \code{measurement_autolevel()}.}
36 \item{only}{a vector with variable names, either as symbols
37 (without quotation marks) or character strings (with quotation
38 markes), the variables in the data set that are to be
39 changed by \code{measurement_autolevel()}.}
40 \item{\dots}{other arguments, currently ignored.}
41 }
42 \examples{
43
44 exvect <- as.item(rep(1:2,5))
45 labels(exvect) <- c(a=1,b=2)
46 codebook(exvect)
47 codebook(measurement_autolevel(exvect))
48
49 avect <- as.item(sample(1:3,16,replace=TRUE))
50 labels(avect) <- c(a=1,b=2,c=3)
51 bvect <- as.item(sample(1:4,16,replace=TRUE))
52 labels(bvect) <- c(A=1,B=2,C=3,D=4)
53 ds <- data.set(a=avect,b=bvect)
54 codebook(ds)
55 codebook(measurement_autolevel(ds))
56 codebook(measurement_autolevel(ds,except=c(a,b)))
57 codebook(measurement_autolevel(ds,only=a))
58 }