| 1 |
\name{duplicated_labels} |
| 2 |
\alias{duplicated_labels} |
| 3 |
\alias{duplicated_labels.item} |
| 4 |
\alias{duplicated_labels.item.list} |
| 5 |
\title{Check for and report duplicated labels} |
| 6 |
\description{ |
| 7 |
The function \code{duplicated_labels} can be used with "item" objects, |
| 8 |
"importer" objects or "data.set" objects to check whether items |
| 9 |
contain duplicate labels, i.e. labels that are attached to more than |
| 10 |
one code. |
| 11 |
} |
| 12 |
\usage{ |
| 13 |
duplicated_labels(x) |
| 14 |
\S3method{duplicated_labels}{item}(x) |
| 15 |
# Applicable to 'importer' objects and 'data.set' objects |
| 16 |
\S3method{duplicated_labels}{item.list}(x) |
| 17 |
} |
| 18 |
\arguments{ |
| 19 |
\item{x}{an item with value labels or that contains items with |
| 20 |
value labels} |
| 21 |
} |
| 22 |
\value{The function \code{duplicate.labels} returns a list with a class |
| 23 |
attribute, which allows pretty printing of duplicated value labels} |
| 24 |
\examples{ |
| 25 |
x1 <- as.item(rep(1:5,4), |
| 26 |
labels=c( |
| 27 |
A = 1, |
| 28 |
A = 2, |
| 29 |
B = 3, |
| 30 |
B = 4, |
| 31 |
C = 5 |
| 32 |
), |
| 33 |
annotation = c( |
| 34 |
description="Yet another test" |
| 35 |
)) |
| 36 |
|
| 37 |
x2 <- as.item(rep(1:4,5), |
| 38 |
labels=c( |
| 39 |
i = 1, |
| 40 |
ii = 2, |
| 41 |
iii = 3, |
| 42 |
iii = 4 |
| 43 |
), |
| 44 |
annotation = c( |
| 45 |
description="Still another test" |
| 46 |
)) |
| 47 |
|
| 48 |
x3 <- as.item(rep(1:2,10), |
| 49 |
labels=c( |
| 50 |
a = 1, |
| 51 |
b = 2 |
| 52 |
), |
| 53 |
annotation = c( |
| 54 |
description="Still another test" |
| 55 |
)) |
| 56 |
|
| 57 |
duplicated_labels(x1) |
| 58 |
ds <- data.set(x1,x2,x3) |
| 59 |
duplicated_labels(ds) |
| 60 |
codebook(ds) |
| 61 |
|
| 62 |
nes1948.por <- unzip(system.file("anes/NES1948.ZIP",package="memisc"), |
| 63 |
"NES1948.POR",exdir=tempfile()) |
| 64 |
nes1948 <- spss.portable.file(nes1948.por) |
| 65 |
duplicated_labels(nes1948) |
| 66 |
} |