I am using Apriori Association rules in R with a database structured as the following. using the following code:
library(arules)
library(arulesViz)
# Convert data into dataframe with two factors
data3 <- as.data.frame(unclass(morse_code_reasonsv2),
stringsAsFactors = TRUE)
# applying appriori
rules7 <- apriori(data3, parameter = list(support = 0.05,confidence = 0.5,minlen=2, maxlen=3), appearance=list(rhs=c("Firm's.global.reorganization=Yes"),
lhs=c("Delivery.time=Yes",
"Automation.of.production.process=Yes"),default="none"))
Using this formula I get the following error:
error in asMethod(object) :
Delivery.time=Yes is an unknown item label, Automation.of.production.process=Yes is an unknown item label
EDIT: data in dput:
structure(list(Firm.s.global.reorganization = structure(c(1L,
2L, 1L, 2L, 2L), .Label = c("no", "yes"), class = "factor"),
Delivery.time = structure(c(1L, 1L, 1L, 1L, 1L), .Label = c("no",
"yes"), class = "factor"), Automation.of.production.process = structure(c(2L,
1L, 2L, 1L, 1L), .Label = c("no", "yes"), class = "factor"),
Poor.quality.of.offshored.production = structure(c(1L, 1L,
1L, 1L, 1L), .Label = c("no", "yes"), class = "factor"),
Made.in.effect = structure(c(1L, 1L, 1L, 1L, 1L), .Label = c("no",
"yes"), class = "factor"), Proximity.to.customers = structure(c(1L,
1L, 1L, 1L, 1L), .Label = c("no", "yes"), class = "factor")), row.names = c(NA,
5L), class = "data.frame")