data("IncomeESL")
IncomeESL[1:3, ]
## remove incomplete cases
IncomeESL <- IncomeESL[complete.cases(IncomeESL), ]
## preparing the data set
IncomeESL[["income"]] <- factor((as.numeric(IncomeESL[["income"]]) > 6) +1,
levels = 1 : 2 , labels = c("$0-$40,000", "$40,000+"))
IncomeESL[["age"]] <- factor((as.numeric(IncomeESL[["age"]]) > 3) +1,
levels = 1 : 2 , labels = c("14-34", "35+"))
IncomeESL[["education"]] <- factor((as.numeric(IncomeESL[["education"]]) > 4) +1,
levels = 1 : 2 , labels = c("no college graduate", "college graduate"))
IncomeESL[["years in bay area"]] <- factor(
(as.numeric(IncomeESL[["years in bay area"]]) > 4) +1,
levels = 1 : 2 , labels = c("1-9", "10+"))
IncomeESL[["number in household"]] <- factor(
(as.numeric(IncomeESL[["number in household"]]) > 3) +1,
levels = 1 : 2 , labels = c("1", "2+"))
IncomeESL[["number of children"]] <- factor(
(as.numeric(IncomeESL[["number of children"]]) > 1) +0,
levels = 0 : 1 , labels = c("0", "1+"))
## creating transactions
Income <- as(IncomeESL, "transactions")
Income
Run the code above in your browser using DataLab