# NOT RUN {
x <- as.item(rep(1:5,4),
labels=c(
"First" = 1,
"Second" = 2,
"Third" = 3,
"Fourth" = 4,
"Don't know" = 5
),
missing.values=5,
annotation = c(
description="test"
))
str(x)
summary(x)
as.numeric(x)
test <- as.item(rep(1:6,2),labels=structure(1:6,
names=letters[1:6]))
test
test == 1
test != 1
test == "a"
test != "a"
test == c("a","z")
test != c("a","z")
test
# }
# NOT RUN {
<!-- %in% 1:3 -->
# }
# NOT RUN {
test
# }
# NOT RUN {
<!-- %in% c("a","c") -->
# }
# NOT RUN {
codebook(test)
Test <- as.item(rep(letters[1:6],2),
labels=structure(letters[1:6],
names=LETTERS[1:6]))
Test
Test == "a"
Test != "a"
Test == "A"
Test != "A"
Test == c("a","z")
Test != c("a","z")
Test
# }
# NOT RUN {
<!-- %in% c("A","C") -->
# }
# NOT RUN {
Test
# }
# NOT RUN {
<!-- %in% c("a","c") -->
# }
# NOT RUN {
as.factor(test)
as.factor(Test)
as.numeric(test)
as.character(test)
as.character(Test)
as.data.frame(test)[[1]]
# }
Run the code above in your browser using DataLab