context("test-describe-rank.R")
test_that("simpel rank works", {
DF <-structure(list(
Geschlecht = structure(c(1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 2L, 2L, 1L,
2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 1L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 1L, 2L, 2L, 1L, 2L, 2L,
2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 1L, 2L, 1L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 2L),
.Label = c("Maennlich", "Weiblich"),
class = "factor"),
Alter = structure(c(2L, 4L, 2L, 4L, 2L, 2L, 2L, 3L, 3L, 2L, 1L,
1L, 3L, 4L, 4L, 4L, 2L, 1L, 2L, 1L, 4L, 4L,
3L, 4L, 2L, 2L, 1L, 4L, 4L, 3L, 3L, 3L, 3L,
2L, 3L, 4L, 3L, 3L, 1L, 3L, 1L, 1L, 2L, 1L,
1L, 4L, 3L, 1L, 4L, 2L, 2L, 1L, 3L, 3L, 2L,
3L, 4L, 4L, 1L, 2L, 3L, 2L, 1L, 2L, 1L, 2L, 3L),
.Label = c("20 - 29", "30 - 39", "40 - 49", "50 - 59"),
class = "factor"),
Konsum = structure(c(1L, 1L, 1L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 2L,
1L, 2L, 1L, 2L, 2L, 2L, 1L, 1L, 3L, 1L, 1L,
1L, 2L, 3L, 2L, 1L, 2L, 2L, 1L, 2L, 2L, 1L,
2L, 1L, 2L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L,
2L, 2L, 2L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 2L,
1L, 1L, 2L, 1L, 1L, 2L, 3L, 1L, 2L, 2L, 3L, 2L),
.Label = c("weniger als 3 T.", "3 bis 6 T.", "mehr als 6 T."),
class = "factor"),
Kaffeeform = structure(c(3L, 1L, 3L, 2L, 3L, 3L, 3L, 1L, 3L, 1L,
3L, 3L, 1L, 2L, 3L, 3L, 3L, 3L, 1L, 3L,
3L, 2L, 2L, 3L, 3L, 3L, 3L, 2L, 3L, 1L,
2L, 2L, 2L, 1L, 3L, 3L, 2L, 2L, 3L, 3L,
3L, 3L, 3L, 3L, 2L, 3L, 3L, 3L, 2L, 3L,
3L, 2L, 3L, 3L, 3L, 3L, 3L, 2L, 3L, 3L,
2L, 1L, 3L, 3L, 3L, 2L, 2L),
.Label = c("Espresso", "Filterkaffee", "Milchkaffee"),
class = "factor"),
FavA = structure(c(3L, 1L, 2L, 1L, 3L, 3L, 4L, 1L, 2L, 2L, 1L,
1L, 1L, 4L, 3L, 4L, 3L, 1L, 2L, 2L, 2L, 2L,
1L, 1L, 3L, 4L, 1L, 1L, 4L, 4L, 1L, 1L, 1L,
2L, 1L, 2L, 4L, 3L, 2L, 4L, 1L, 1L, 2L, 2L,
2L, 4L, 2L, 2L, 2L, 1L, 3L, 2L, 4L, 2L, 4L,
1L, 4L, 4L, 2L, 1L, 1L, 4L, 2L, 1L, 3L, 2L, 3L),
.Label = c("Cubanischer Arabica Filter", "Cubanischer Arabica Kaltextrakt",
"Dallmayr Prodomo Kaltextrakt", "Dallmayr Prodomo Filter"),
class = "factor"),
FavB = structure(c(4L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 1L, 4L,
4L, 2L, 2L, 2L, 2L, 4L, 3L, 1L, 1L, 1L, 1L,
2L, 2L, 2L, 2L, 2L, 4L, 2L, 2L, 3L, 4L, 4L,
1L, 3L, 1L, 2L, 4L, 4L, 1L, 3L, 3L, 1L, 3L,
1L, 1L, 1L, 3L, 1L, 2L, 2L, 1L, 3L, 3L, 3L,
2L, 2L, 3L, 3L, 2L, 4L, 1L, 1L, 2L, 2L, 1L, 2L),
.Label = c("Cubanischer Arabica Filter", "Cubanischer Arabica Kaltextrakt",
"Dallmayr Prodomo Kaltextrakt", "Dallmayr Prodomo Filter"),
class = "factor"),
FavC = structure(c(2L, 3L, 3L, 4L, 1L, 2L, 1L, 4L, 4L, 3L, 2L,
3L, 3L, 3L, 4L, 3L, 2L, 2L, 3L, 3L, 3L, 3L,
3L, 3L, 4L, 3L, 3L, 3L, 3L, 1L, 4L, 3L, 2L,
3L, 2L, 3L, 1L, 2L, 3L, 2L, 4L, 4L, 4L, 4L,
3L, 2L, 3L, 1L, 3L, 4L, 4L, 3L, 2L, 1L, 1L,
3L, 3L, 2L, 1L, 4L, 2L, 3L, 3L, 4L, 1L, 3L, 1L),
.Label = c("Cubanischer Arabica Filter", "Cubanischer Arabica Kaltextrakt",
"Dallmayr Prodomo Kaltextrakt", "Dallmayr Prodomo Filter"),
class = "factor"),
FavD = structure(c(1L, 4L, 4L, 2L, 4L, 4L, 2L, 3L, 3L, 4L, 3L,
2L, 4L, 1L, 1L, 1L, 1L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 1L, 1L, 4L, 2L, 1L, 3L, 2L, 2L, 3L,
4L, 4L, 4L, 3L, 1L, 1L, 3L, 2L, 2L, 3L, 1L,
4L, 3L, 4L, 4L, 4L, 3L, 1L, 4L, 1L, 4L, 2L,
4L, 1L, 1L, 4L, 3L, 3L, 2L, 4L, 3L, 4L, 4L, 4L),
.Label = c("Cubanischer Arabica Filter", "Cubanischer Arabica Kaltextrakt",
"Dallmayr Prodomo Kaltextrakt", "Dallmayr Prodomo Filter"),
class = "factor")),
.Names = c("Geschlecht", "Alter", "Konsum", "Kaffeeform", "FavA", "FavB", "FavC", "FavD"),
row.names = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 12L, 13L, 14L, 15L,
16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L,
28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, 36L, 37L, 38L, 39L,
40L, 41L, 42L, 43L, 44L, 45L, 46L, 47L, 48L, 49L, 50L, 51L,
52L, 53L, 54L, 55L, 56L, 57L, 58L, 59L, 60L, 61L, 62L, 63L,
64L, 65L, 66L, 67L, 68L), class = "data.frame")
expect_warning( expect_equal(
as.character(Rangreihe(~FavA+FavB+FavC+FavD, DF )$results$FavA),
c("31% (21)", "33% (22)", "15% (10)", "21% (14)" ) )
)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.